TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-30-2007, 06:35 AM   #1 (permalink)
The Contributor
 
marxx's Avatar
 
Join Date: Sep 2007
Location: Finland
Posts: 45
Thanks: 3
marxx is on a distinguished road
Default Good 'n Fast thumbnail script?!

Hello all!

Does anyone know good and fast thumbnail script?
I have trying many thumbnail functions and scripts and none of them are:
- fast enough
- Doesn't do what it should
- Is too complicated

Perfect script for me would be:
- What rename files
- Support for .gif .jpeg .png .bmp
- easy to use.. Function would be the best!

Before you post "Do it yourself" .. Well, I have try many times, but my skills just aren't that good! (yet) :(
I would use this in site where member is uploading picture, script is generating 3 versions of it. Small thumbnail (80x80), preview thumbnail (150x150) and view image (640x480) and uploading those own folder.

Thanks for all help - Marxx
Send a message via MSN to marxx
marxx is offline  
Reply With Quote
Old 09-30-2007, 12:05 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I use the following function, but I wrote it almost a year ago now so it may not be the best way of doing it. You've got to remember though that manipulating images is an intensive task in itself.

PHP Code:
function doResize($szSource$szDestination$szExtension$iResizeWidth$iResizeHeight)
{
    declare(
ticks 1)
    {
        
$szExtension strtolower($szExtension);
        
         switch(
$szExtension)
         {
             case(
'jpg'):     $pSource imagecreatefromjpeg($szSource); break;
             case(
'jpeg'):     $pSource imagecreatefromjpeg($szSource); break;
             case(
'gif'):     $pSource imagecreatefromgif($szSource); break;
             case(
'wbmp'):     $pSource imagecreatefromwbmp($szSource); break;
             case(
'png'):     $pSource imagecreatefrompng($szSource); break;
         }
         
         
$pResized imagecreatetruecolor($iResizeWidth$iResizeHeight);
         list(
$iWidth$iHeight) = getimagesize($szSource);
        
         if(!
imagecopyresampled($pResized$pSource0000$iResizeWidth$iResizeHeight$iWidth$iHeight))
         {
             return 
false;    
         }

        switch(
$szExtension)
        {
             case(
'jpg'):     $pResult imagejpeg($pResized$szDestination100); break;
             case(
'jpeg'):     $pResult imagejpeg($pResized$szDestination100); break;
             case(
'gif'):     $pResult imagegif($pResized$szDestination); break;
             case(
'wbmp'):     $pResult imagewbmp($pResized$szDestination); break;
             case(
'png'):     $pResult imagepng($pResized$szDestination); break;
         }
         
        if(
$pResult)
        {
            return 
true;
        }
            
        return 
false;
    }

__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 09-30-2007, 07:10 PM   #3 (permalink)
The Contributor
 
marxx's Avatar
 
Join Date: Sep 2007
Location: Finland
Posts: 45
Thanks: 3
marxx is on a distinguished road
Default

Ok, thanks wildhoney.. I'll try this one! :)
Send a message via MSN to marxx
marxx is offline  
Reply With Quote
Old 10-31-2007, 01:01 AM   #4 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Does anyone have a newer script that works like this?
Or is this script still up to date? :)
Tanax is offline  
Reply With Quote
Old 10-31-2007, 02:14 AM   #5 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Resizing has never really been a fast task. Very server intensive. I'd say that's the best you're going to get because although the code may be a little out-dated, the process remains the best way to do it:
  • Load the original image into a new resource
  • Extract the original image's height and width
  • Create a blank canvas
  • Resize the original image and place it into the new canvas
  • Save the image
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-31-2007, 08:49 AM   #6 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

Try the imagemagick extension, its muchos better at image manipulation but its very hard to grasp as there is not much in terms of documentation on it.
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote
Old 10-31-2007, 11:22 AM   #7 (permalink)
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

I sometimes use this class: http://www.gen-x-design.com/projects...bnailer-class/
Sam Granger is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:23 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design