Use php and imagemagick to handle uploading and scaling of image files
It is very simple to upload files with php, but if you want to scale the uploaded images, although you can use GD to do it,
you need Perform more tedious processing. ImageMagick is an image processing package that is available in most Linux software packages. It contains many
tools for image processing. It can convert image file formats and perform various processing on images. Among them, we will use its
image scaling function. This is achieved through the convert tool in its software package. In this way, call
convert -geometry width x height source file scaled file
Please create an images directory in the current directory, and it can Make it writable by the web execution user. This directory is used to store uploaded images and
zoomed images.
The following is a simple example, including image uploading and processing, which was tested under RedHat6.0+php3.0.12. > ">
〈FORM ENCTYPE="multipart/form-data" ACTION="upload.php3" METHOD=POST>
Select image file: 〈INPUT NAME="image" TYPE="file">
〈INPUT TYPE="submit" VALUE="Send File">
〈/FORM>
〈/BODY>
〈/HTML>
upload.php3: Process the uploaded images File
";
if(isset($image) && $image &&
($image_type = "image/gif" || $image_type = "image/png" ")){ //Determine the format of the uploaded file, etc.
$dest_image = "./images/".$image_name;
if(@copy($image,$dest_image)){ //Copy the uploaded file to Under the 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