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