EDIT: Fixed! I'm using a php script to produce a different png image depending on the query string input, but it's producing a different result to the actual png. Here's the actual png image that should be displayed: Here's the image the script outputs: Also, the "unrated" image isn't displaying correctly at all. Here's what it's supposed to look like: And here's the script output: And finally here's the script: <?php require_once( 'config.php' ); $image_path = $cfg[ 'path' ][ 'relative' ] . '/img/ratings/'; $rating = (float) $_GET[ 'rating' ]; $rating = round( ( $rating * 2 ), 0 ) / 2; // Round to nearest half if ( $rating < 1 || $rating > 5 ) { $rating = 'unrated'; } if ( ! $image = @ImageCreateFromPng( $image_path . $rating . '.png' ) ) { $width = 60; $height = 12; $image = imagecreatetruecolor( $width, $height ); $background = imagecolorallocate( $image, 255, 255, 255 ); imagecolortransparent( $image, $background ); $forground = imagecolorallocate( $image, 0, 0, 0 ); imagefilledrectangle($image, 0, 0, $width, $height, $background ); imagestring( $image, 1, 3, 3, 'Error!', $forground ); } header('Content-type: image/png'); imagepng( $image ); imagedestroy( $image ); ?> PHP: What's going on?
Add these two lines before imagepng($image); imagealphablending($image, true); imagesavealpha($image, true); PHP: (This is necessary to work with transparent pngs such as yours)