Use PHP and ImageMagick to process image file upload and zoom processing (repost) _php tutorial

Source: Internet
Author: User
Tags imagemagick
Use PHP and ImageMagick to handle upload and zoom processing of picture files
PHP processing file Upload is very simple, but if you want to upload the image to scale processing, although can use GD to do, but
To be more cumbersome to handle. ImageMagick is an image processing package that is available in general Linux software packages. It contains the allowable
Multi-processing Image tool, which can be converted into image File format can also be processed for various images, where we will use its
Image zoom function. This is done by using the tool in its package, convert, to invoke the
Convert-geometry width x Kogen file after zooming in

Please create a images directory under the current directory, and allow the Web execution user to write, this directory is used to store the uploaded images and
The scaled picture.
Below is a simple small example, including image uploading and processing, tested under redhat6.0+php3.0.12.
uploadform.html: File Upload Form
〈html>
〈head>
〈title> Select File 〈/title>
〈/head>
〈body align= "CENTER" >
〈form enctype= "Multipart/form-data" action= "Upload.php3" method=post>
Select Picture file: 〈input name= "image" type= "file" >
〈input type= "Submit" value= "Send File" >
〈/form>
〈/body>
〈/html>
UPLOAD.PHP3: Processing the uploaded image file
〈html>
〈head>
〈title> processing 〈/title>
〈/head>
〈body>
〈?
$flag = "true";
if (Isset ($image) && $image &&
($image _type = "Image/gif" | | $image _type = "Image/png"
|| $image _type = "Image/pjpeg")) {//To determine the format of the uploaded file, etc.
$dest _image = "./images/". $image _name;
if (@copy ($image, $dest _image)) {//copy upload file to images directory
$small _image = "./images/small". $image _name;

http://www.bkjia.com/PHPjc/445276.html www.bkjia.com true http://www.bkjia.com/PHPjc/445276.html techarticle PHP and ImageMagick to handle the upload and zoom of the image file processing PHP processing files Upload is very simple, but if you want to upload the image to zoom processing, although you can use G ...

  • Related Article

    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.