Home  >  Q&A  >  body text

PHP scales images. When the image size is small (for example, the width is less than 100 pixels), garbled characters will be output.

$src_img=imagecreatefrompng('example.png');//Source image
$goal_img= imagecreatetruecolor($goal_width, $goal_height);//Target image
imagecopyresampled($goal_img, $src_img, 0 , 0, 0, 0, $goal_width, $goal_height, $img_width, $img_height);//Zoom
//Output
header('content-type:image/png');
imagepng( $goal_img);
imagedestroy($src_img);
imagedestroy($goal_img);

好名字好名字2272 days ago1064

reply all(0)I'll reply

No reply
  • Cancelreply