Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » thumbnail creation without save?
Search Topic:
Uniqs:
15
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


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

thumbnail creation without save?

i have the code in place to create a tumbnail via php from an image..

but i want to create and DISPLAY it only the fly.. not save it to a directory..

i know that i can call:

img src = "myscript.php?arguments"

but i can't pass the filename, etc of the image i want to create the thumbnail from..

if i call the function directly in the img scr.. then the page is ONLY the thumbnail.. not contained in an image..

any insights on how to make a thumbnail for display on a page without saving it to a directory??
--

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


Lazarus Long

join:2000-11-24
Saint Louis, MO

Look at some of the image functions in PHP.

I use the following the ImageCopyResized and ImageJpeg functions to create thumbnails on the fly

Hope this helps
--
Always listen to experts. They'll tell you what can't be done, and why. Then do it.


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

reply to Roundboy
i actually got it working..

I have the proper workings of the functions.. it ust wasn't displaying..

but it turns out i had an error in the php age i was calling.. resulting in no image..

everything is working on the fly now.. no thumbnails saved


Leif3
Force Me

join:2002-04-25
reply to Roundboy
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


Leif3
Force Me

join:2002-04-25
reply to Roundboy
I'll try it out and let you know. Many thanks. PHP continues to amaze me.
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersAny way to advance... »
« [Help] Setting up Apache HTTP server and FTP  


Monday, 09-Nov 03:43:43 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [156] Cable Uncapper Faces Criminal Charges
· [140] AT&T Sues Verizon Over 3G Ads
· [112] Why Run Fiber When You Can Run Ads That Pretend You Do?
· [109] Comcast Is Simply Getting Huge
· [93] Apple Cooking Up New $30 A Month TV Service?
· [83] Bits Of ACTA Agreement Leaking Out
· [80] Will 'Three Strikes' Come To The United States?
· [78] Verizon To Double Smartphone ETFs?
· [77] Verizon: Droid Tethering Will Cost $30 Extra
· [73] Comcast, NBC Deal Almost Complete
Most people now reading
· Lots of problems lately? [Rogers]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· [Rant] Brand New 'Jasper' Xbox360 - RRoD Hardware Failure [Rants, Raves, and Praise]
· [WIN7] Which Services in Win 7 Have You Turned Off? [Microsoft Help]
· Divorce advice... [General Questions]
· Connecting to Google Voice Via SIP [VOIP Tech Chat]
· Is Gear Score now the new requirement to get pug invite? [World of Warcraft]
· Security Software Updates - 09 Nov 2009 [Security]
· Windows 7 boot manager editing questions [Microsoft Help]
· [ Classes] ATTN Death Knights - Post your spec for critique! [World of Warcraft]