PHP implements image upload and uses ImageMagick to generate thumbnails, _php tutorials

Source: Internet
Author: User
Tags imagemagick learn php learn php programming

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.