Below is my image generate code:
$thumb = imagecreatetruecolor($newwidth, $newheight) or die('Cannot Initialize new GD image stream');
print_r($thumb);
$source = imagecreatefrompng($filename) or die('Cannot Initialize new GD image stream');
print_r($source);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
@imagepng( $thumb, $original_img_dir_absolute_path.$original_img_name, 0 );
it will generate first png but with black background only. anybody have idea about it.
Your code seems to be OK. You may check if the fragment does not take a black part of the original image. You can also try to remove your "quality" parameter of imagepng()
:
imagepng($thumb, $original_img_dir_absolute_path . $original_img_name);
Maybe your original image have a low contrast, and the low quality shows you a black image.