私はいくつかの解決策に出くわしましたが、それらはすべて画像のアップロードに基づいていました. 私が望むのは、あるフォルダーから画像を取得し、特定のサイズにサイズ変更してから、他のフォルダーに保存することです。
2 に答える
0
PHPライブラリ関数を試すimagecopyresized()
サンプルプログラムはこちら
// File and new size
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-Type: image/jpeg');
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb);
これは imagecopyresized() のマニュアルです。 http://www.php.net/manual/en/function.imagecopyresized.php
于 2014-04-16T06:43:00.797 に答える
0
通常、これには GD ライブラリを使用します。それは正常に動作します。例として、次の URL を参照してください: http://runnable.com/UnF-tFdudNt1AABt/how-to-resize-an-image-using-gd-library-for-php
于 2014-04-16T06:43:46.393 に答える