zubrag.com
Free php and cpanel scripts to automate your daily routine

Free PHP Scripts :: Thumbnail Creator / Generator

PHP Thumbnail Creator is designed to generate thumbnails from JPG, GIF, or PNG images. Script can save rendered thumbnail as file on your server or output it directly to the browser.

Requirements:
  • PHP 4.0.6
  • GD 2.0.1 or later

Features:
  • JPG, PNG, GIF image type supported (depends on GD2 library)
  • Proportional image resize
  • Create thumbnails from files on the server or from remote images (by URL)
  • Save thumbnail as file on server, or output directly to the browser
  • You can override generated thumbnail type. All thumbnails can be of the same type (i.e. all JPG) regardless of the source image type
  • All thumbnail properties can be controlled via parameters
  • Supports custom default values (change default values in the script code)

Sample usage:
  • Save created thumbnail on server
    http://www.zubrag.com/thumb.php?src=http://www.test.com/test.jpg&dest=thumb.jpg&x=100&y=50
  • Output created thumbnail to the browser
    http://www.zubrag.com/thumb.php?src=test.jpg&x=50&y=50&f=0

Script can also help you if you need to show few thumbnails based on the same source image but in different sizes, when you cannot afford saving created thumbs on your server for some reason.

Parameters:
  • src - path to source image
  • dest - path to save created thumbnail (required only if saving generated thumb to file)
  • x - max thumbnail width
  • y - max thumbnail height
  • q - thumbnail quality (applicable only to JPG, 1 to 100, 100 - best)
  • t - thumb type. "-1" - same as source, 1 = GIF, 2 = JPG, 3 = PNG
  • f - save to file (1) or output to browser (0).

Note: this tool cannot create website snapshots. Read following article on how to generate website thumbnails: Website Snapshot / Thumbnail Creators

Download Thumbnail Creator / Generator


Comments

Jeff August 5, 2006
Perfect tool!
August 14, 2006
A sample script would be helpful
zubrag August 15, 2006
What do you mean by sample script? What that sample script should perform?
Brian August 15, 2006
This is the best script EVER!!! But I was wondering... will this delay loading time?

zubrag: it may delay loading time if you are generating thumbs on the fly (output directly to the browser) and your hosting server is highly loaded. This may be an issue if you have thousands of image generations per hour. In this case you would better use pre-generated thumbnails to not consume all the hosting server resources. Thanks for your comment, as it inspired us to think on thumbnail caching feature for this tool.
Brian August 18, 2006
Thank you for your response. I've been trying to use an uploading method integrating with this Thumbnail Generator resizing both the uploaded image and create a thumbnail but have had NO luck haha. Would be awesome if you were able to have that attached to this somehow.
August 20, 2006
It'd be nice if it batch processed thumbs. :(

zubrag: we'll add one more tool for this soon.
Billy August 24, 2006
Can this script auto generate a thumbnail if we pass a website URL as a parameter? This could act as an Alexa alternative since they turned paid. Thanks.

zubrag: Unfortunately this tool cannot generate website snapshots. Please read following article on how to generate website thumbnails: Website Snapshot / Thumbnail Creators
jack September 2, 2006
i like your scripts very much, but how to get the generated thumb file(name and path), please?
zubrag September 2, 2006
http://www.zubrag.com/thumb.php?src=http://www.test.com/test.jpg&dest=thumb.jpg&x=100&y=50
you specify filename with "dest" parameter above, and path most likely will be folder where script resides. We'll add "path to save thumbnails" tomorrow.
Kate September 12, 2006
Grate tool. It helped me a lot :)
jack [anti-spam] coats.org September 15, 2006
How could I have it BOTH save to a file and output to a browser? (and possibly just display the file if it is already generated?
DJ October 3, 2006
hi, How do I use this script inside a class.. it works great, but I need to call it inside a class.. whenever I call it, it just gives me blank image
October 4, 2006
Would it be possible to have a version where we can have "fixed height and width" thumbnails, cropped ?

Thanks
October 7, 2006
On a server with Ensim control panel when trying to make thumbnail from image of 1600x1200 pixels, script does not create thumbnail. It just gives blank screen with no messages. I've tested it on a several Ensim servers and always the same. Could it be that Ensim has some strange configuration so image functions don't work?
October 7, 2006
ps. with images smaller than 1270x1000 it works, also on servers with cpanel it works with all sizes of images.
harryyabbats [anti-spam] yahoo.com October 11, 2006
Yes, batch processing would be great. It would be nice if thumbsnails were output to a subdirectory created during execution too. I was also wondering if the script could be located in one directory and pass the image source directory to the script. So as to be able to handle multiple directories as they call for the script?
Thanks. I will check back.
st October 12, 2006
I tryed to put this in a function but it doesn't work :S
Can any one help me?
gowri.raveendran [anti-spam] gmail.com October 18, 2006
I used your code for creating thumbnails,
but it created thumb for some images,for other images imagetype not supported message is coming but all jgg images only
achaia3 [anti-spam] gmail.com October 21, 2006
I love this tidy little script, except I am having a problem with large files not generating... probably the same issue as the Oct. 7 comment. It seems that any files larger than ~400K won't work, regardless of image dimensions.

I have a "home" hosting account with 1and1

Thanks
Charlie
http://charlie.charliecorp.com/
October 30, 2006
hey man, thanks alot.
i was looking for a simple Image Resampler like this for 3hrs. good luck.
November 4, 2006
a few of my images dont seem to work, i keep getting the error

<br />
<b>Warning</b>: Unexpected character in input: '' (ASCII=15) state=1 in <b>/var/www/vhosts/DOMAIN/httpdocs/store/products/large/UV-AMP1K.JPG</b> on line <b>56</b><br />
<br />
<b>Parse error</b>: parse error, unexpected
November 4, 2006
I found out the problem it was to do with include($from_name); I changed it to


case 2:
header("Content-type: image/jpeg");
$thumb=imagecreatetruecolor($max_x,$max_y);
$source = imagecreatefromjpeg($from_name);
imagecopyresampled(
$thumb, $source, // destination, source
0, 0, 0, 0, // dstX, dstY, srcX, srcY
$max_x, $max_y, // dstW, dstH
$orig_x, $orig_y); // srcW, srcH
imagejpeg($thumb,"",$image_quality);

break;



and it seems to work ok, it was a problem with the max width
November 14, 2006
er, i have a problem, this script does not support uploading to server, that i could cselect a file and it would change it to thumb, how could i do that?
birkto [anti-spam] gmail.com November 14, 2006
it's a very nice script... very nice... but i don't know who to use it with image in a db... check that image pleas...

HELP....!!! HELP....!!! HELP....!!!

http://www.carmenenlinea.com/img.php?id=9

thanks =)
Shane [anti-spam] mac.com November 14, 2006
I am so sorry to sound so unqualified to be using this... but being a newbie, I don't understand yet, how to implement this code. Where do i put it etc.
colin [anti-spam] rainsforth.com November 16, 2006
Excellent script. One of the quickest and easiest I have seen for this purpose.

I am currently putting together a simple contribution to the ZenCart project (http://www.zencart.com) for which I have used this script.

Would you be happy for me to include this script as part of the download package?
erinther [anti-spam] gmail.com November 19, 2006
Hi,
I'll look like as a stupid, but i don't know how to use this script. I've put it on my server, but then I don't know what to do. should I write a form to send details to thumb.php or what?
bond2u gmail.com December 13, 2006
Very nice idea...I'm unfamiliar with implementation though. Sample script requests are meaning - what do you do with your created script? We would love to learn about this so we don't have to keep asking the same question to you...or anyone else. You have this working everyone? Then how about posting some links to the operational script and show everyone how to use it? That would be really generous of you..right?
December 22, 2006
It's useless mate ...

it does not keep the transparency at pngs
January 2, 2007
Is it possible to create images in a folder within the thumb folder it is not working for me.
dest=nec/VT48.jpg
igorberger [anti-spam] yahoo.com January 3, 2007
It allows you to make a tumb from a file#1.gif or jpg but you must have thumb#1.gif or jpg created first! If you do not have dest=thumb#1.gif created you get an erro! Cannot write to a file!!!
You should be able to make new to thumb without manually creating the file!
Also must change permission to 666 on the thumb.gif before you can write to it!

Please update this part on the script!
sticky January 5, 2007
I think that you need to outline how this works. Several people here obviously are clueless about how you are supposed to call the script in code. You have an example url, but where on earth do you place it? In the "src" property of an img? That's why I'm assuming. Give us a clue, willya!
January 9, 2007
Well all I was trying to find out if the script can create a directory so if I wan to create an image thumb in NEC directory can it be done?
singhashok15 [anti-spam] gmail.com January 23, 2007
using imagettftext x-axis never cnanged
kiran_sonawane [anti-spam] benchmarkitsolutions.com January 31, 2007
Hi Everyone..

I have generate the thmbnail and displayed on broswer. But if i want to display that image in HTML tags the image cannot be displayed. it prints like in binary format. I dont want to store that thumnail in specific folder. I want to generate that thumbanail on the fly..

If anyone knows about this .. Please help me on that..

Thanks in advance
Alessandro Marinuzzi [Alecos] February 6, 2007
Great! Your script works very fine!!!
I changed the path as follow:

$thumbs_folder = '../pic/';

so it works very fine on every server ;-)
Sunchaser February 10, 2007
Great script, very flexible and easy to use
LordZoster February 18, 2007
[2007-02-18]
changed lines
[49] image_folder = '';
and
[55] thumbs_folder = '';
so i can use this marvellous script even with relative paths (eg. thumb.php?src=../images/...)

Wish-list: output the thumb even in case of copy.
Andrew February 22, 2007
How have you guys gone about calling the thumb.php script to resize pictures?

When I try use require_once() or include() and pass the parameters manually as session variables I recieve an error indicating that the file cannot be found.

For example:

require_once('thumb.php?src=$_SESSION['user_id'].jpg&dest=$_SESSION['user_id']_thumb.jpg')

gives me an error, since the file (if user_id =2) 'thumb.php?src=2.jpg&dest=2_thumb.jpg' indeed does not exist.

Ideas?
thumbler March 22, 2007
I use it like this: file_get_contents("http://example.com/thumb.php?src=source.jpg&dest=thumb.jpg");
April 1, 2007
thanks for this tool...
Do you plan to add a "cache-system"?
Jan Ove April 7, 2007
Should be a added feature to force the thumb to be 100 x 100 etc Beacuse my gallery will use 100 x 100 thumbs and i dont want it to keep one side 100 and the other one etc 50...
erick_the_viking [anti-spam] yahoo.com April 28, 2007
Is it possible to add in a redirect ( header() ) once the compression script has run. I am unable to add this to a place in the script that works.
ben.marshall [anti-spam] gmail.com May 9, 2007
Hello, I needed the ability to run this from the command line. So I added the following code.

if ($argv)
for ($i=1;$i<count($argv);$i++)
{
$var = split("=",$argv[$i]);
$_REQUEST[$var[0]] = $var[1];
}
Apollwnas June 10, 2007
Hello. This is a great script.But what about security?
1.If someone types http://www.myserver.com/thumb.php?src=http://www.test.com/test.jpg&x=50&y=50&f=0
will the script run, causing load to the server?
2.Can someone execute 'evil' script on my server by passing php code in the src variable?
http://www.myserver.com/thumb.php?src=[evil code].
Thanks in advance for your reply
Bjarne, Denmark June 24, 2007
For all you newbies, just like me, I've made a tutorial:
http://web199896.web26.talkactive.net/imageview/

Have fun!
aen June 27, 2007
Check out thumbnailspro.com, pretty cool site
prashant June 30, 2007
this script works fine. its ultimate
igorberger July 24, 2007
You need to change the temp folder to chmod 777 in order to save gifs generated by the script, make sure the temp is in root not publi_html or you will be hacked

Also get_file may not work on your server so modify the script using curl_init and save to a temp file before invocing with the script.

Check culr_init in www.php.net for a function to save the file after you curl it.

Support www.phsdl.net anti Spam project!
September 14, 2007
i m getting an error .. image type not supported.. though my input and output both are in .jpg .. please help
September 14, 2007
Does this script allow me to resize the image and keep the aspect ratio?
blake September 14, 2007
I have the same problem: "image type not supported," even for jpegs.
September 15, 2007
I had the same problem "image type not supported" I just edited the script and changed the call to the function like this. GenerateThumbFile($from_name, $thumbs_folder. $to_name, $max_x, $max_y);

Basically you do not need $images_folder after you make this edit.

I appreciate the script, just what I was looking for.
September 20, 2007
I can not say this thumbnail generator good it is the simplest and the best i have seen before.
Chris M October 17, 2007
When I tried running this it crashed my Apache server, and since I haven't been able to run PHP scripts. :/ I dare say I did something wrong.
Ramon October 22, 2007
very useful script
thanks
www.cricketu.com November 19, 2007
I am not able to create this :(
ethan [anti-spam] alyrica.net December 27, 2007
I just wanted to say thanks. Such a great script.
Darby January 4, 2008
Hey, thanks for the script! I added cropping functionality. Now, I can pass in the top left point and the bottom right point of the area I want, and then scale down that cropped area. It's great!
junaid_arif [anti-spam] hotmail.com January 20, 2008
I love you man !
=)
February 5, 2008
Beautiful script! It's small, clean, simple, and it does exactly what it's supposed to do. Nice job! Thanks!
se.optimation [anti-spam] gmail.com February 7, 2008
On your description about " Create thumbnails from files on the server or from remote images (by URL) "

Can i make tumbnail from PDF file on front of page ?

Thanks..
se.optimation [anti-spam] gmail.com February 7, 2008
my mean:

Can this script to make thumbnail from PDF file on first page?

Thanks
Geoff February 13, 2008
How do I set HSPACE, and Alignment on the image? Thanks!
Geoff February 14, 2008
I worked it out -- the code returns the value for the SRC attribute in the <img src="[url]" /> tag.

Excellent, thanks!
Steph February 14, 2008
great script

no useless files, easy integration, great work

i salute you
evil February 16, 2008
Hi,
how can i set fix sizes(x,y) for the thumbnail?
Matt February 20, 2008
Hi,

The script works great on local files but doesn't work on files hosted on another server. Just get the dreaded red cross. Any ideas where I am going wrong?

<img src=http://www.myserver.com/thumb.php?src=http://www.remoteserver.com/images/image.jpg&x=150&y=150&f=0>

This is a great script! Thanks!
" />
techker [anti-spam] gmail.com February 25, 2008
i have tried everything and it always says images folder does not exist..

i have tried all the combinations..
nemec.com.au February 26, 2008
Great script. Took about 10 mins to implement in three places on my site. Thankyou. -Daniel
March 28, 2008
thankss very muchhh !!
it helped a lot .
beuthling [anti-spam] gmail.com April 20, 2008
Thank you !
You script is great. Forum was a great help. oh ya thank you !_!.
staffan.estberg [anti-spam] gmail.com April 22, 2008
Great script! I'm trying to make the thumbs generate at 100x100 px, no matter their original size. Is there any way to remove the constrain prorpotions feature?

Thanks,
-Staffan
July 3, 2008
very good
dvtay [anti-spam] yahoo.com July 11, 2008
Does it not work on windows server 2003?
ldunbar [anti-spam] cfl.rr.com July 19, 2008
image.class.php alters the values of max_x and max_y. The class cannot be used inside a loop, for example, to create thumbnails of an entire directory because of this.
July 20, 2008
To all those struggling to modify this script and make a function instead of the post method. It works but you have to be very careful, easy to make a mistake or forget something.

Remember to declare settings variables as global in the function.
July 30, 2008
How to make it support JPG GIF PNG.
Now it only supports jpg gif png.

It does not support with capital letters :S
July 31, 2008
Why does it nok take images greater than 1Mb ?
mathias wedeken August 21, 2008
Hi,

works great. Only issue: I tried it on images above 3 MB, and somehow it changes portrait to landscape in those- and only in big images. when they are small (bytesize-wise), everything seems to work. Bizarre, isnīt it?
September 5, 2008
how do i do transparency for png and gif?
October 10, 2008
Hello,

I am trying to generate thumbnail using the zubrag i have download required classes(thumb.php,image.php).when script is running then i am facing the error(undefined function) on fuction imagecreate on line($ni = imagecreate($this->max_x, $this->max_y))in image.class.php.
Can you tell me whats the saluation for that or if i need to any more php class other then thumb.php,image.class.php.
Kidly reply me as soon as posible.
Thanks
Baljeet gaheer.
magne_nygaard [anti-spam] yahoo.no November 9, 2008
Greate script! But would it be posible to make it keep the animations when it's creating thumbs of gif's?

Would be a wery nice future ;)
Farhan November 11, 2008
Can we download a file to the local machine to a specific directory like c:\webs\test\download please reply
November 14, 2008
This script does NOT support remote images thumbnailing.
phoenix December 17, 2008
It not work.
iooo December 17, 2008
Not work stupid
jorgeortega11 [anti-spam] hotmail.com January 9, 2009
it doesnt work, waste of time...
beuthling [anti-spam] gmail.com January 21, 2009
hello zubrag great script was was. I got it working on my main server in godaddy.
Freekin perfect !_! . But I cant get it to work under any of the alised domains. i mean godaddy has this multihost thing under a premium acount. My main site works great. but it does not work in any of the subfolder domains. I have tryed almost everything. to modify paths nothin-----
o im saposed to be on the forum sorry !_!

Great script
January 27, 2009
The colors in the thumb are completely off for me for some reason... no matter what type of image I input or settings I use, it outputs a pretty lousy looking GIF image. How come only I have that problem?
beuthling [anti-spam] gmail.com January 29, 2009
GREAT SCRIPT !_! !_!
this adress my post above -
Solved godaddy multi host issue.
I am only allowed to use the script in the top folder or main domain. so all my allised domains have to call the file from the main domain. or top folder !_! alrighty then - Il be back if anyone has problem with the godaddy jsut ask
thinkdj February 9, 2009
Would be great if caching is enabled (like timthumb)
February 11, 2009
great script! thank you!
webmaster [anti-spam] dirlist.net February 13, 2009
I like this script.
Thanks for the script anyway!

Leonid
http://www.dirlist.net
Web Directory and Search Engine
Pushpinder Bagga February 24, 2009
I am working on PHP 5.0+ and it doesnt work with Remote Images, With Local Images its the coolest images, seems like we have to download the image to a temp variable and then supply that to this script... then it might work... I will try phpThumb prior to doing this... thanks anyways...
arash February 25, 2009
very nice and handy script but i donno how i can change resolution of uploaded images.(for jpg and png)

in fact i want to resample images which their resolution are higher than 96dpi to 96dpi.
Sunchaser February 28, 2009
phpthumb has some problems rendering remote images (gives 404 errors).

timthunb is less complicated than phpthumb but does not have support for remote images

So i think at the end your script is the better one.

I added to your script a remote paremter so one can specify if he wants to render a local image or a remote one.

You should implement caching for the local images, is not very difficult.
brsw March 27, 2009
Great script! Thank you
anhera March 30, 2009
oyeee muchas gracias por el script, es perfecto!! simple y funcional =D
Franco April 5, 2009
Ta weno muchas gratias eh
michael April 7, 2009
you can also look at that
http://freelogic.pl/thumbnailer/
Aravinth April 12, 2009
Get help spend a day on searching lastly landed here solved my problems.Many Thanks
aslep June 27, 2009
one more functione:
http://www.phpinform.com/2009/06/27/thumbnails-php-function-to-create-small-images/
Rana Awais from sangla hill July 8, 2009
i used that script but does not work correctly there was an error please tell me how we can use it also have ie-capt
shweta July 24, 2009
Its really amazing. I tried all stuff on the net for thumbnail images. None of them worked except yours.
Thanks.
rjl [anti-spam] dreamwc.com July 26, 2009
Great, now how do I display a thumbnail and information for mp4 video files in a directory on my LINUX apache web server running php5?
August 7, 2009
The link posted by aslep was ingenious!

This one: http://www.phpinform.com/2009/06/27/thumbnails-php-function-to-create-small-images/

Thanks!
WebHead August 11, 2009
For wen site thumbnails - http://phpthumb.sourceforge.net/

All you need is PHP and ImageMagik
annam August 25, 2009
there is a bug in the code, even if the src is an external link it attaches the $image_folder to the link, which results into somethink like:

src = "/images/http://example.com/myimage.jpg"

and of course you get a "file doesnt exist" error.

you need to change this to only attach the folder name if the src is not a URL.

i also had a problem with file_get_contents and as mentioned above, i used curl instead.
pavol.cervenka [anti-spam] slovanet.sk September 29, 2009
Hi my problem is that when i start the script it tels me Cannot download image and when try to download if from outside url so i think that there is problem with temp files please help me
October 1, 2009
ahh, WHERE is the damn script!
Gareth November 1, 2009
Thanks for this. I've been writing a cms for the last few weeks and needed to resize images and have been having major difficulties. I was looking for a function to include in my upload script, but this is even better, because being a relative php newbie all i do is call the script on my upload confirmation page to show what was uploaded! Excellent.
Rui November 3, 2009
Excelente
nazmul_basher [anti-spam] yahoo.com December 22, 2009
I like it very much about the quality of output and specially for .png

Thanks
December 22, 2009
So i think at the end your script is the better one.

I added to your script a remote paremter so one can specify if he wants to render a local image or a remote one.

You should implement caching for the local images, is not very difficult.

<a href="http://www.networkauthentication.net">Network Authentication</a>
January 2, 2010
Great script!
can you please release it under GPL license?
kaippally [anti-spam] gmail.com January 11, 2010
Hi, The scripts work fine, but I am unable to use it to retrieve images hosted on blogger and picasaweb. Is there a way around this problem
romboutv [anti-spam] gmail.com January 20, 2010
Hi i want to add a better cropping tool so i can define a better crop. Like position and crop area
james February 5, 2010
I too would like to know if PDF files are supported. Thanks.
February 11, 2010
Can any one plz tell me how to incorporate these script in any other theme? I mean where all do I need to make changes, I am newbie in PHP and WP too, please guide me....waiting for help :(
February 11, 2010
Alex
(sorry i dint mention name prior to these)
Can any one plz tell me how to incorporate these script in any other theme? I mean where all do I need to make changes, I am newbie in PHP and WP too, please guide me....waiting for help :(
Manik February 22, 2010
Hi. A little newb help required. The thumb.php code sits within another php file that's in the same directory as the image.png, so i declare the src parameter like this $src = "/directory_name/image.png";

I get the "Source file name must be specified." error. What am I doing wrong? Please help
forum wont let me post April 2, 2010
Ive done it before - but i cant figure out where i put that dam page grrrr. ;D

Im pretty shure this script is capable of saving the thumb directly from a form field ????

My question is can I generate and save a thumb, using something like this

<cfhttp url="http://thegreatestsiteontheplanet.ca/portfolio/thumbmespace.php?src=#form.photo#&dest=#uploaddirectory#&f=1"
method="get">

Without presaving the file and trying to use its source on the server to create a thumb. I keep reading that every one is using a current (already there) image. I just want to send and save

Thank you zubrag for great script, im coldfusion guy so php is a little messed up.
jody.tbk [anti-spam] gmail.com April 12, 2010
Thank you so much... your a live saver!
was using phpthumb before but moved to php5 and the script hung on me.
Sniver April 26, 2010
I am really glad i came across this script. thanks man!!
Keith May 20, 2010
Hi Zubrag, thanks for this script! Do you know of an easy way to implement a cropping feature?
bhallash [anti-spam] yahoo.com June 5, 2010
I was searching this only , but unfortunatly http://soleilrealtors.com/admin/upload/thumb.php?src=grad2-2.gif&x=100&y=100&f=0

is not working , could you help ?
bhallash [anti-spam] yahoo.com June 5, 2010
i tried posting but its giving me "advertisement not allowd page "
August 13, 2010
Funciona una maravilla y con muy poco esfuerzo.
Sajo September 23, 2010
Not able to create thumpnail to browser using remote file
pinoytambayerz.tk November 7, 2010
Images folder does not exist (update $images_folder in the script)
December 14, 2010
The author claims that this script supports remote images. IT DOES NOT SUPPORT REMOTE IMAGES - the claim at the top is completely FALSE.
Stop falsely representing your script!!
asmaa.green January 6, 2011
A great code , that is exactly what i needed for
thank you so mush
February 15, 2011
Great Script! Simple and useful. Thanks a lot.
sandeep [anti-spam] dronasys.com May 2, 2011
i am not able to convert if i pass url....
can you help me please
mikesch June 19, 2011
Very usefull script. Thank you very much!
prashant July 6, 2011
how to use this tool dear

can u write the procedure how can i use this tool.......plssssssss
Narxx July 12, 2011
Awesome script!
Had to make some changes for it to work with my other scripts, but it's amazing!!
Thank you SO MUCH for this!
It's the second time I'm using your php scripts - you are awesome!
aandreyy96 [anti-spam] yahoo.com July 24, 2011
I have searched for a script like this :D very good script ! Good Job !
imagemozdirectory [anti-spam] gmail.com August 10, 2011
Great script for my site www.imagemoz.com
Thanks a lot.
September 30, 2011
Wow, 5 years later these scripts still works awesome! Thx Zubrag!!

-Evasiv Design
Maddy Vora December 2, 2011
Hi Can you please Give me Demo code how to i integrate in my code, coz i am trying to use this but i cant get proper result,
Thnx & regards,
Maddy Vora
munirsunni@gmail.com
pervasive December 19, 2011
@evasiv: programming code doesnt alter over time, remains the same.
claraanggraini [anti-spam] ymail.com April 14, 2012
still work, old scripts but i just try it and i use it now on my web. thanks.
Milan Gatyas March 12, 2013
This is just i was looking for. Much thanks :)
gpstore84 [anti-spam] gmail.com April 11, 2013
Create thumbnail image by php
When we upload large size images on server. Uploaded large images take more time to load on webpage, so we need to show small size images on our webpage. Image thumbnail is a solution to generate uploaded image’s thumbnail to show required size images on our website.
http://codelibrary.googleplus.co.in/create-thumbnail-image-by-php/
wolf5 [anti-spam] hotmail.com January 15, 2014
I cant wait to make a thumbnail yay!!!
Bud May 9, 2014
I keep getting this as a response fro the thumb generator
"Source file name must be specified."

I am pretty dure the path to the images and to the thumbs folder (where the new images) is correct.What is the issue???
Viswalinga Surya S August 4, 2014
Is there any page where the complete documentation is available? I wanna learn about how `cut_x` and `cut_y` works.
3medya August 27, 2014
I tryed to put this in a function but it doesn't work :S
Can any one help me?
Thanks
http://www.3medya.com
spam [anti-spam] rumental.com December 23, 2014
cut_z and cut_y are based on the original images sizes, not the max thumb sizes.
but without the ability to center the crop its kind of pointless ( it need offsets added or calculated )

So say you want thumbs to be always square, then you can set cut_? to the shortest dimension of the original image.

5000x3000
max_x = 500
cut_x = 3000
should give you a 500px square for example
Ice January 28, 2015
To center the crop add this code:

if ($this->cut_x > 0 || $this->cut_y > 0)
{

$x0 = ($orig_x / 2) - ($this->cut_x / 2);
$y0 = ($orig_y / 2) - ($this->cut_y / 2);
}
else
{
$x0=0;
$y0=0;
}


....
--insert here--
//cut image if specified by user
...


and edit imagecopyresampled like this:

imagecopyresampled(
$ni, $im, // destination, source
0, 0, $x0, $y0, // dstX, dstY, srcX, srcY
$this->max_x, $this->max_y, // dstW, dstH
$orig_x, $orig_y); // srcW, srcH

Send cut_x=minsize and cut_y=minsize, where minsize is original height or original width, whichever is the shortest dimension. If image is 5000x3000, than cut_x=3000 and cut_y=3000.

waseem Akram April 21, 2015
Can this create a watermarked thumbnail i tried but display nothing
petdro.raptile.7 [anti-spam] gmail.com May 30, 2015
Perfect...thankz
Taras July 1, 2015
Good script but don't work with some images:
don't work with http://www.makeyourownjeans.com/thumb.php?src=images/attributes/arnold_hw_dg.jpg&x=170&y=170&f=0
but work with http://www.makeyourownjeans.com/thumb.php?src=images/attributes/arnold_hb_dg.jpg&x=170&y=170&f=0

Tell me please why this happend and how to fix this.

Thanks.
July 2, 2015
Taras, both URLs work for me.
alecosnet [anti-spam] gmail.com September 16, 2015
I'm preparing to move under php 7 and your class (I think) needs to be updated since php7 removed php 4 costructor from the class. Let's me know if you can fix your class...

Thanks..
--
Alessandro
Snehanshu April 17, 2016
Superb script. Very useful. Goin' to use it commercially
September 27, 2016
This great script was included as part of a module for Zen Cart attributes. But since php version changed from 5.3 to 5.4 it's not creating the thumbs. Please upgrade.
September 28, 2016
It worked for me on PHP 5.4 and PHP 5.6. But I didn't try on Zen Cart, maybe something has to be fixed in Zen Cart attributes plugin.
vhmdmansoorali [anti-spam] gmail.com July 14, 2017
Its asking for the source name to be mentioned.

"Source file name must be specified."

Where to mention it? Can anybody help me please.
Rabby December 3, 2019
Genius Developer. I want to hire you for my website project.
mansoorkhan5355 July 21, 2020
How to create website blogg
alchemy [anti-spam] geocaches.org January 4, 2021
This was a great script. Been using it since 2008 on various web sites Ive had over the years. Am trying to revive an old site but tns are not being created anymore. MY ISO is running PHP 5.3.9. It used to work, but I haven't been actively using it since 2012. haha