使用ImageMagick上载时调整图像大小/缩小/缩略图
问题描述:
我有HTML表单来上传图片,我想在上传过程中调整大小/缩小/缩略图.
i have html form to upload images , I want to Resize-reduce/thumbnail during the uploading process.
$uploadDir= "/uploads";
$imageName= $_FILES['image']['name'];
$tempPath = $_FILES['image']['tmp_name'];
move_uploaded_file ($tempPath,$uploadDir);
缩小大小:
convert $imageName -resize 800x600 -strip -quality 50 -interlace line output.jpg
缩略图:
convert $imageName -resize x120 -gravity center -crop 120x120+0+0 +repage thumb_output.jpg
这是第一次使用Imagick!
this is the first time using Imagick !
谢谢
答
使用nohup在后台使用exec()运行这些命令.
run these commands using exec() in background using nohup.
exec('nohup convert ... > /dev/null &');