PHP program generated by thumbnail images

Source: Internet
Author: User
Pages uploaded by the client:

--------------------upload.htm---------------------

<form enctype= "Multipart/form-data"

Method= "POST" action= "upload.php" >

<input type= "hidden" name= "max_file_size" value= "10240000000" > Please select or enter the upload file name: <input name= "upfile" type= "file" >

<input type= "Submit" value= "Start uploading" >

---------------------upload.php-------------------

<?
if (empty ($upfile)) {

Print ("No file was transfered!\n no files uploaded!");

Exit

}

$image _path= $upfile;

@ $image _info=getimagesize ($image _path);

if ($image _info[2]==2)

{@ $image 2=imagecreatefromjpeg ($image _path);

}

else if ($image _info[2]==1) {

@ $image 2=imagecreatefromgif ($image _path);

}

Else

if (Empty ($image 2))

$image 2_x=imagesx ($image 2);

$image 2_y=imagesy ($image 2);

if ($image 2_x== $image 2_y) {

$x = 150;

$y = 0;

}

else if ($image 2_x> $image 2_y) {

$x = 150;

$y =intval (150* $image 2_y/$image 2_x);

}

else{

$y = 150;

$x =intval (150* $image 2_x/$image 2_y);

}

$image 1=imagecreate ($x, $y);

Imagecopyresized ($image 1, $image 2,0,0,0,0, $x, $y, $image 2_x, $image 2_y);

Imagegif ($image 1, "new.gif");

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