PHP implements image upload and uses ImageMagick to generate thumbnails,
With ImageMagick, you can easily and quickly create thumbnails that are much easier to use than PHP.
<?php//location to upload main image: $mainDir = $_server[' Document_root ']. ' /images/l/';//location to create the thumb Image: $smalDir = $_server[' Document_root ']. ' /images/s/';//Command to use: $command = '/usr/bin/convert ';//Thumbnail width: $size = 210;//Make sure we had an image:i F (isset ($_post[' submit ')) {if (getimagesize ($_files[' photo ' [' tmp_name '])) {$name = $_files[' photo '] [' name '];$ UploadFile = $mainDir. $name; Move_uploaded_file ($_files[' photo ' [' tmp_name '], $uploadfile); $lrgImg = $mainDir. $name; $smlImg = $smalDir. $name; $imageMagick = $command. " '". $LRGIMG. "'-resize ' $size '". $SMLIMG. "'"; shell_exec ($imageMagick);} Header ("Location:/test.php"); exit;} Else{?><?phpforeach (Glob ($smalDir. ' * ') as $img) {echo ' ;}}? >
I hope this article will help you learn PHP programming.
Articles you may be interested in:
- PHP picture upload class with picture display
- Simple PHP Image upload Program
- PHP Image upload Class Code
- Super easy to use a PHP upload image class (random name, thumbnail, add watermark)
- PHP Image Upload Code
- Phpthumb PHP Image thumbnail gallery
- thinkphp Image upload function sharing
- PHP implementation of the support ImageMagick and GD library two processing thumbnail generation class
- PHP multiple file and image upload examples of detailed
http://www.bkjia.com/PHPjc/1110083.html www.bkjia.com true http://www.bkjia.com/PHPjc/1110083.html techarticle PHP implements image uploads and uses ImageMagick to generate thumbnails, and with ImageMagick, you can easily and quickly create thumbnails that are much easier than using PHP. php// location to upload ...