Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » thumbnail creation without save?
Search Topic:
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Any way to advance... »
« [Help] Setting up Apache HTTP server and FTP  
AuthorAll Replies


Leif3
Force Me

join:2002-04-25
reply to Roundboy
Re: thumbnail creation without save?

Could you post a sample of some code.
Thanks.


Roundboy
Premium
join:2000-10-04
Drexel Hill, PA

certianly..

I call the image like:

IMG SRC="/makeimage.php?file=$file">

this means call the makeimage.php file with arguments that the php code needs:

makeimage.php :

code:

// set base image
$image = "/home/ercdvs/public_html/archive/$id/$file";
$image_info = getimagesize($image);
// image specifics
$too_big_diff_ratio = $image_info[0]/$max_width;
$new_img_width = $max_width;
$new_img_height = round($image_info[1]/$too_big_diff_ratio);

// determine image type
if($image_info[2] == "2") // JPEG
{
// This is for resizing JPG only
Header ("Content-type: image/jpeg");
$src_img = @imagecreatefromjpeg($image);
$dst_img = @imagecreatetruecolor($new_img_width,$new_img_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_img_width, $new_img_height, $image_info[0], $image_info[1]);
imagejpeg($dst_img,'',90);
ImageDestroy($src_img);
ImageDestroy($dst_img);

}

This code takes the directory and filename of the big image.. and if it is a jpg, resizes to a max width of 100, and a hieght keeping with the image ratio

I need to write vrey similar code for gif, png, etc.. but 99.9% of m images are jpg.

feel free to copy and ask me any questions.
--

Girls are like internet domain names, the ones I like are already taken. Unless you get one from a strange country

I dont know the difference between games and reality anymore ...I just used a shotgun on my mother and she's not respawning
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersAny way to advance... »
« [Help] Setting up Apache HTTP server and FTP  


Sunday, 06-Dec 02:49:27 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.republican-creole
page compression OFF
Most commented news this week
· [163] Comcast Releasing Promised Usage Meter
· [147] Avast Antivirus Has Gone Mad
· [128] Comcast Makes NBC Universal Acquisition Official
· [123] The Bandwidth Hog Does Not Exist
· [105] Graduate Student Unveils Sprint's GPS Sharing With Feds
· [101] Google Invades ISP, OpenDNS Turf With Google Public DNS
· [85] FCC Ponders Moving From PSTN To IP Voice
· [82] Latest Consumer Reports Survey Not Kind To AT&T
· [80] New Bill Aims To Limit ETFs
· [75] Sprint Defuses GPS Privacy Media Bomb
Most people now reading
· False positive in Avast! or is it real? [Security]
· Wife might have to work in.... Iowa for a few months!!! [General Questions]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· [How to] Install Asterisk on an Asus WL-520GU router [VOIP Tech Chat]
· First commercial tool to crack BitLocker arrives (Updated) [Security]
· Connecting to Google Voice Via SIP [VOIP Tech Chat]
· Problems with rlslog.net? [TekSavvy]
· Using AirMax to provide triple play services? [Wireless Service Providers]
· [Unlock] TUTORIAL: VONAGE WRTP54G/RTP300 WITH 5.01.04 [VOIP Tech Chat]
· Many Sites Unreachable [Rogers]