ホームページ  >  記事  >  バックエンド開発  >  PHP GD ライブラリは、JPG 画像サイズのぼやけの解決策を処理します

PHP GD ライブラリは、JPG 画像サイズのぼやけの解決策を処理します

WBOY
WBOYオリジナル
2016-07-25 08:57:351805ブラウズ
  1. header("Content-type: image/png");

  2. $temp_width = 150;

  3. $temp_height = 180;< ;/p>
  4. $img_path = "test.jpg";

  5. $img_path2 = "test2.jpg";

  6. $im = @imagecreatefromjpeg($img_path);< /p>

  7. $temp_img=imagecreatetruecolor($temp_width,$temp_height);

  8. imagecopyresampled($temp_img,$im,0,0,0,0,$temp_width,$temp_height,$temp_width,$temp_height);
  9. //echo $temp_img;
  10. //imagejpeg($temp_img);
  11. imagepng($im,$img_path2);

  12. /*

  13. imagecopyresize($temp_img,$im,0,0 ,0,0,$temp_width,$temp_height,$srcW,$srcH);
  14. $ni=imagecreatetruecolor($width,$height);
  15. imagecopyresampled
  16. $res = function_exists('imagecreatetruecolor');
  17. var_dump($res) ;
  18. */
  19. ?>

复制代


声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。