icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Thumbnail Create, save thumbnail.

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old October 18th, 2005, 9:35 AM   #1 (permalink)
Registered User
Comfy Contributor
 
Daniel_Hatcher's Avatar
 
Joined in Dec 2004
Lives in United Kingdom
Hosted on pass74
146 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
Thumbnail Create, save thumbnail.

I got this from php.net

PHP Code:
// The file
$filename 'pic.gif';

// Set a maximum height and width
$width 200;
$height 200;

// Content type
header('Content-type: image/gif');

// Get new dimensions
list($width_orig$height_orig) = getimagesize($filename);

if (
$width && ($width_orig $height_orig)) {
   
$width = ($height $height_orig) * $width_orig;
} else {
   
$height = ($width $width_orig) * $height_orig;
}

// Resample
$image_p imagecreatetruecolor($width$height);
$image imagecreatefromgif($filename);
imagecopyresampled($image_p$image0000$width$height$width_orig$height_orig);

// Output
imagegif($image_pnull100); 
Now it creates the image but i want it to save in a folder called thumb with the name thumb_pic.gif, i can't figure it out.

WHAT I'M DOING

I'm trying to create a script that scans serveral folders in a directory for images then creates the thumbnails and adds them to a mysql database.

IE.

Folder - images/OB |||| images pic1.gif - pic2.jpg

CREATE THUMBNAIL

Thumbnail folder: thumb/OB |||| thumb_pic.gif - thumb_pic1.jpg
__________________
http://residentfantasy.com

Last edited by Daniel_Hatcher; October 18th, 2005 at 9:38 AM..
Daniel_Hatcher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Rate This Thread
Rate This Thread:

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

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