GD: php imagepng creates whitespace in image
I have some problem with GD when i creates images with php.
The strange thing is that it works on one server with php version 5.3.1 but not on php version 5.2.14. (I'm not sure if it's the php version or the GD lib that is doing this.)
captcha::get_file()
.
imagecreatefrompng()
and imagepng()
What causes this, and how can I fix it?
Here is the phpcode:
<?php
session_start();
require_once("./captcha.php"));
// creates the image with convert and returns the location of the picture
// document_root/picture/picture.png
$picloc = captcha::get_file();
$image = @imagecreatefrompng($picloc);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
unlink($picloc);
?&开发者_运维问答gt;
not positive, but the problem may be in your content length header.
header('Content-Length: ' . strlen($image));
at this point in your code, $image is a resource data type, not a string. try simply removing the content-length header line, and see what happens.
精彩评论