私は次のPHPスクリプトを使用して画像をアップロードしています。php class.upload.phpを使用して2つのサイズの画像を複数アップロードするには?
https://github.com/verot/class.upload.php/blob/master/README.md
まあ、今は2つのサイズで複数の画像をアップロードしたいです。 1つはが大きく、があり、その他はが小さいです。だから、
、この結果を得るために、私は次のコードを使用していますが、それはこの小さなイメージ - >$handle->file_new_name_body = 'mpic_thumb'.uniqid('', true);
PHPコード保存しないです:
foreach ($files as $file) {
$handle = new upload($file);
if ($handle->uploaded) {
$handle->file_new_name_body = 'mpic_'.uniqid('', true);
$handle->image_resize = true;
$handle->image_ratio_fill = true;
$handle->image_x = 360;
$handle->image_y = 240;
$handle->file_new_name_body = 'mpic_thumb'.uniqid('', true);
$handle->image_resize = true;
$handle->image_ratio_fill = true;
$handle->image_x = 100;
$handle->image_y = 65;
$handle->process('images/menu_images/');
if ($handle->processed) {
echo 'image thumb resized';
$handle->clean();
} else {
echo 'error : ' . $handle->error;
}
}
}
ああ、それは今動作しています。この方法ではなく、最初のプロパティ: –
の後に '$ handle-> process( 'images/menu_images /');を呼び出す必要があります。別の関数を2つ作成しようとすると、1つはサムネイル用、もう1つは通常画像用です。また画像のサイズがそのサイズよりも小さいという問題があるかもしれません – Nehal
はい、私が言うようにしようとしていたものでした@shibbir ahmed – Nehal