I always wanted to find a program for the thumbnail of an image on the Internet, but I still didn't find the program without deformation. Generally, the source image is scaled simply.
I think it may already exist, but I did not find it, so I can't write one by myself. In fact, it's not all written by myself,
On the basis of existing changes!
The source code is as follows:
<? Php
/*
* Copyright Description: This version is developed on the basis of "IEB_UPLOAD CLASS Ver 1.1".
* Image cropping will make the image distorted and distorted! I made changes based on the program, using data parameters and the original image
* Compare the file parameters (mainly the width and height) to obtain the proportional value. The scaled image is scaled in the same proportion as the original image. However
* The image is then taken from the center of the intermediate image to obtain the thumbnail. Of course, the image will be cropped, but it is minimized.
* Crop!
* Programming: swin. wang Email: php_in_china@yahoo.com.cn QQ: 592298893
*
* You can use this program without restrictions, but please keep the copyright information
×
× Illegal use:
* $ Upfos = new ieb_upload ('photo _ file', './up_img'); name of the photo_file form file. Do not add $;./up_img to the upload location.
* $ Old_file_name = $ upfos-> getName ();
* $ Old_file_fooder = $ upfos-> getExt ();
* $ File_size = $ upfos-> getSize ();
* $ File_name = $ upfos-> newName ();
* $ Upfos-> upload ($ file_name );
* $ Upfos-> thumb ("small _", 125,120 );
* $ New_file_name = $ upfos-> UpFile (); $ new_file_name name of the uploaded big Image
× $ Small_file_name = "small _". $ new_file_name; $ small_file_name name
*/
Class ieb_upload {
Var $ FormName; // file domain name
Var $ Directroy; // upload to the Directory
Var $ MaxSize; // maximum upload size
Var $ CanUpload; // whether the file can be uploaded
Var $ doUpFile; // name of the uploaded file
Var $ sm_File; // The name of the thumbnail.
Var $ Error; // Error parameter
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.