pmiller624 Posted March 20, 2010 Share Posted March 20, 2010 Hello, I'm trying to create a simple 'not available' image with a dynamic width and height. My problem is that above the text, in the image, the colors get a little distorted/blurred. I have attached an example of the problem... Here's my code... $width = $_GET['w']; $height = $_GET['h']; $font = "arial.ttf"; $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); $background = ImageColorAllocate($image, 46, 46, 46); ImageFill($image, 0, 0, $background); $box = @imageTTFBbox(11,0,$font,'NOT AVAILABLE YET'); imagettftext ( $image, 11, 0, $width/2-($box[4]/2), $height/2-($box[6]/2)+20, $grey, $font, 'NOT AVAILABLE YET' ); $box = @imageTTFBbox(15,0,$font,'?'); imagettftext ( $image, 15, 0, $width/2-($box[4]/2), $height/2-($box[6]/2), $grey, $font, '?' ); header("Content-Type: image/jpeg"); ImageJpeg($image); ImageDestroy($image); Anyone know why this is happening? Thanks [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/195954-php-gd-distortion-over-text/ Share on other sites More sharing options...
Alex Posted March 20, 2010 Share Posted March 20, 2010 Try: imagejpeg($image, null, 100); To set it to the highest quality. Link to comment https://forums.phpfreaks.com/topic/195954-php-gd-distortion-over-text/#findComment-1029275 Share on other sites More sharing options...
pmiller624 Posted March 20, 2010 Author Share Posted March 20, 2010 Thank you so much, I wasn't aware that there are more parameters in ImageJpeg, worked perfect. Link to comment https://forums.phpfreaks.com/topic/195954-php-gd-distortion-over-text/#findComment-1029277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.