Image processing software Photoshop ajax+php The five-picture processing of the learning side

Source: Internet
Author: User
First prev:


Create a form in sample6_1.php:

Copy the Code code as follows:


Show upload status and pictures

The upload file needs to be defined enctype, in order to show the image set target to Uploadframe


Upload Image function Uploadimg:

Copy the Code code as follows:


function Uploadimg (theform) {
Submit Form
Theform.submit ();
Show upload status in Showimg
SetStatus ("Loading ...", "showimg");
}
Upload status function
function SetStatus (thestatus, theobj) {
obj = document.getElementById (theobj);
if (obj) {
obj.innerhtml = "" + Thestatus + "";
}
}


process_upload.php provides file upload function:

Copy the Code code as follows:


Provides a picture type check
$allowedtypes = Array ("Image/jpeg", "Image/pjpeg", "Image/png", "Image/x-png", "image/gif");
File storage Directory
$savefolder = "Images";
If there's a file upload, start working.
if (Isset ($_files[' myfile ')) {
Check if the upload file conforms to the $allowedtypes type
if (In_array ($_files[' myfile ' [' type '], $allowedtypes)) {
if ($_files[' myfile ' [' error '] = = 0) {
$thefile = "$savefolder/". $_files[' myfile ' [' name '];
Uploading Files via Move_uploaded_file
if (!move_uploaded_file ($_files[' myfile ' [' tmp_name '], $thefile)) {
echo "There is an error uploading the file.";
}
else{
?>
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >






"/>


}
}
}
}
?>


The Doneloading function in the last part of the code above is used to display the image and modify the size of the image. Which will be used to thumb.php, it will be in the images directory to generate the source image of the large, medium and small three size, interested can be studied. Welcome everyone to shoot bricks ~
Text Source package Download

The above describes the image processing software Photoshop ajax+php edge learning side of the five image processing, including the image processing software Photoshop content, I hope to be interested in PHP tutorial friends helpful.

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