Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2003
Posts: 121
Journeyman
Journeyman
Offline
Joined: Aug 2003
Posts: 121
Ok, here's one for you...

There are many thumbnail image creating PHP scripts out there, but all require you to save the image. I don't want that and I was wondering if anyone has tried to do this...

I would like to create a table of thumbnail images (as links to the full sized image, of course) WITHOUT saving the resized image. Meaning the script would run as a PHP page, create the images and links but not have the overhead of storing the images - they only exist in the array. I haven't been able to do this and don't know if you can do this, but basically the concept is to use the (thumb) image object, display it, then destroy it.

Any ideas?

Tom

Sponsored Links
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Why do you not wish to store the thumbnails? Resizing a whole bunch of images is NOT going to be a low-load operation.

There's no real way to do this as an all-in-one operation... the HTML document that creates the page can't really embed images internally (in most browsers, anyway)...

Each image request would have to be to the thumbnail script itself, while the HTML just creates the list of images...


UBB.classic: Love it or hate it, it was mine.
Joined: Aug 2003
Posts: 121
Journeyman
Journeyman
Offline
Joined: Aug 2003
Posts: 121
I wanted to be able to just upload images into directories and link PHP pages to those directories which would create thumb images and links without intervention. I didn't want to have to create 2 separate images upload 2 separate directories, nor did I want to have to run the PHP script every time I uploaded pictures in order to get the thumb images. For that matter, photoshop has a great "automation" feature that will create thumbnails that is less lossy than PHP GD.

Basically, I wanted to drag, drop, and forget about it, but as you stated, I don't think that this is possible.

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
Lossy?

Are you working with true colors when making your thumbnails?

Check out this (somewhat sloppy) thumbnail code that I'm using...

http://flareupload.pleh.net/quickthumb.txt

It creates true-color PNG thumbnails out of anything GD can read. Pass mkthumb the source directory (of the main image), the target directory (where thumbs are stored), the filename of the image in the source directory, and an optional flag to force recreation of the thumbnail.

Right now all the error checking bits at the bottom are commented out so that it won't kill the script when trying to thumbnail, say, a text file.

The thumbnail viewer calls this function for every large file it finds, thus creating the new thumbnails on the fly... no need to run it as a separate app.

(FlareUpload is pretty nifty, ain't it? )


UBB.classic: Love it or hate it, it was mine.
Joined: Aug 2003
Posts: 121
Journeyman
Journeyman
Offline
Joined: Aug 2003
Posts: 121
Adobe uses true ~ basically just resizing the original and renaming. Haven't tried it in the script - Adobe seems easier at this point.

I've seen a few scripts similar in concept but was hoping that I could creat a truly dynamic page. I see though with a browser only parsing, unlike the JVM, I cannot hold on to images without physical files.

You can use...
Code
 <br />while($img = readdir($img_directory))<br />{<br />	$split = explode(".", $img);<br /><br />                 //string together any image types here...||..||..||<br />	if ($split[1] == "jpg" || $split[1] == "jpeg") <br />	    $images[] = $img;<br /><br />}// end creating array of image items in directory<br /> 


...to filter non image files and avoid your errors.

Thanks for all the replies.

Tom

Sponsored Links
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
The problem with that code is that it blindly assumes that a file named "whatever.jpg" is an image, and that the filename only has one dot...

Rule number 1: Users are malicious
Rule number 2: If not malicious, then clueless



IMO, checking out the results of getimagesize() alone is enough to determine if a file was an image. I could probably just have the code return if the "image" has no size.


UBB.classic: Love it or hate it, it was mine.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,575
Posts293,932
Members13,824
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,835
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)