I am storing images in a folder in the server and getting ther paths in the db.if i am doing like this how can i make thumpnails and display images please help me. i am new to GD
Thumbnail generation
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
This thread has been split from viewtopic.php?t=35204
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I wrote a tutorial that covers it: viewtopic.php?t=41743
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Another alternative would be to use a templating system like Template Lite. It has a built-in thumbnail plugin that can auto create thumbnails for you and store them in a seperate directory.
{resize_image}
The above example would take the image Myfile.jpg located in the /html/mysite/ad_images/ directory and create a thumb_Myfile.jpg thumbnail image in the /html/mysite/thumbnails/ directory with a max image size of 150x200 and with the correct aspect ratio.
It returns...
...in html output for the page.
{resize_image}
Code: Select all
{resize_image img_src="/thumbnails/" directory="/html/mysite/ad_images/" thumbdir="/html/mysite/thumbnails/" filename="Myfile.jpg" xscale="150" yscale="200" thumbname="thumb_"}It returns...
Code: Select all
<img src="/thumbnails/thumb_Myfile.jpg" width="150" height="200" alt="image" border="0">- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
TemplateLite is a Smarty rewrite/improvement. It uses the same syntax as Smarty, but is considerably lighter is memory usage and overall size. It is a great tool, and one I'd recommend.
This is a neat feature, one I did not know about...
And why wasn't this more widely known, mister?AKA Panama Jack wrote:Template Lite ... has a built-in thumbnail plugin that can auto create thumbnails for you and store them in a seperate directory.
{resize_image}
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Template Lite is a clone of Smarty that was written from scratch to be smaller and faster.aniltc wrote:thanks to all
But how can i integrate with smarty?can u show me some examples?What is Template lite?
How can i use this with Smarty?
And you really need to check the sites about how to use templating in your code. It's not an easy thing to really explain here.
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Well, it was mentioned in the news on the Template Lite site, change logs and documentation.Everah wrote:TemplateLite is a Smarty rewrite/improvement. It uses the same syntax as Smarty, but is considerably lighter is memory usage and overall size. It is a great tool, and one I'd recommend.
And why wasn't this more widely known, mister?AKA Panama Jack wrote:Template Lite ... has a built-in thumbnail plugin that can auto create thumbnails for you and store them in a seperate directory.
{resize_image}This is a neat feature, one I did not know about...
BTW, it is far more powerful than you might think. It can even download images from other sites, store them and convert them to thumbnails. It will use CURL to grab the image if CURL is installed on the server. If not then nothing will happen.
I basically got tired of doing everything in PHP and then sending two different images to the template. Now I can send just one image name and let the template do the rest. Overall it just made things so much easier.
BTW, PHP news sites only tend to look at something once and then ignore it. Unless you happen to be special to someone on the editorial staff.