View Full Version : Make thumbnail
10-11-2003, 01:57 PM
I have some art on my website, I want a thumbnail next to the description, but I just want it the actual art just resized and linked to the actual large one. How can I do this using PHP GD library?
I'll leave the page coding to you though, that just handles the thumbnailing to file aspect.
10-11-2003, 02:21 PM
$variable = new Thumbnail('images/resource_name.jpg',120,120,'thumbs/output_name.jpg',85,'
Can I use a gif with it?
If you PHP+GD build supports gif reading then yes you can, else no.
10-11-2003, 02:45 PM
$variable = new Thumbnail('art/1/brightlite8x6.gif',120,120,'art/1/8x6thumb.gif',85,'
Gives me a parse erron on line 3. What do I name this file and what is the thumbnail_create.php? and why is it included once?
well, thumbnail_create.php will be the process file that you downloaded from the linked page with all the transformation and proportional resizing algorythms contained.
you may need to amend the include path if you uploaded it to a different directory.
Also remember to chmod art/1 to 0777 so you can write the thumbnail to it.
If you really fancy going overboard with all this learning type thing then you might also decide to go back to the linked page and read the text that comes between the sample code. ;)
10-11-2003, 09:49 PM
SDP2006: The parse error comes from the first unescaped single quote in front of "C3DDEE". You need to escape the single quotes inside the last parameter with a backslash.
Íkii: I find it very awkward and unintuitive that the last parameter of your Thumbnail constructor is a string with array values inside. Why not use a real array instead, with keys as the method names and the values consisting of an array of parameters for the corresponding method? You could loop through this array, check with method_exists() if this key is a method of Thumbnail, and invoke it via call_user_func_array(). Currently you use eval(), which I would try to omit, because of the side effects that can arise if bad code is passed o it. Just a quick refactoring tip. ;)
Originally posted by mordred
Íkii: I find it very awkward and unintuitive that the last parameter of your Thumbnail constructor is a string with array values inside.
I know ;)
Was written quite a long time ago and I'd use a totally different approach nowadays if I was to rewrite the class. Is probably simpler for most OOP programmers to omit the last param and direct call the transformation functions singly
Seems that most people using it aren't yet really into object programming so they just follow the instructions (well, in most cases anyway) without looking too far into the structuring.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.