Php and imagemagick are used to process the upload and zoom (posting) of image files ). It is easy to use php and imagemagick to process the upload and scaling of image files. However, if you want to scale the uploaded image, although G can be used with php and imagemagick to process Upload and zoom of image files
Php is very easy to process file uploads. However, if you want to scale the uploaded image, you can use GD,
Complicated processing is required. ImageMagick is an image processing package, which is available in common Linux software packages. It contains
The multi-processing image tool can convert the image file format and perform various processing on the image.
Image scaling function. This is implemented through convert, a tool in its software package, so as to call
Convert-geometry width x High source file scaled file
Create an images directory in the current directory and enable users to write images on the web. this directory is used to store uploaded images and
The scaled image.
Below is a simple example, including image upload and processing. the test passes in RedHat6.0 + php3.0.12.
Uploadform.html: file upload form
<HTML>
<HEAD>
<TITLE> select a file </TITLE>
</HEAD>
<Body align = "CENTER">
<Form enctype = "multipart/form-data" ACTION = "upload. php3" METHOD = POST>
Select an image file: <input name = "image" TYPE = "file">
<Input type = "submit" VALUE = "Send File">
</FORM>
</BODY>
</HTML>
Upload. php3: process uploaded image files
<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") {// you can specify the format of the uploaded file.
$ Dest_image = "./images/". $ image_name;
If (@ copy ($ image, $ dest_image) {// copy the uploaded file to the images Directory
$ Small_image = "./images/small". $ image_name;
Php is very easy to process file uploads, but if you want to scale the uploaded image, although G...