Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Thumbnail

Status
Not open for further replies.

jamesjames1

Technical User
Jun 18, 2004
81
GB
Hi,

Does anyone know how to create a thumbnail using all the files in a folder. I have written some code but the rendering process to create thumbnails from the contents of a folder times out after about 10 or so thumbnails.

It seems a bit strange does anyone know a way to get this to work properly, here is the code:

<html>
<body bgcolor="#C0C0C0">

<%
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set MyFiles=MyDirectory.GetFolder(Server.MapPath("james/hawes"))
For each filefound in MyFiles.files

response.write ("<IMG HEIGHT=50 WIDTH=50 SRC=""" & "/james/hawes/" & filefound.name & """></A>")

Response.Write ("<a href=""" & "/james/hawes/" & filefound.Name & """>" & "CLICK - J & hyperlink name " & filefound.Name & "<br />" )



Next
%>


</body>
</html>
 
How big (in KB or MB) are the files in the folder?

Your code is not creating a thumbnail. It's forcing the browser to scale the full images to fit in a 50 x 50 space. This will work if the files aren't too big, but usually the results don't look very good--you will get distortion or ugly scaling artifacts--and the images will load much slower than a real thumbnail.

Better to resize the images using a graphics program and then upload the thumbnails, or, if graphics software is installed in the server (e.g., ASPImage), you could write code to create thumbnails on the fly if they don't already exist.

Also, your code looks mixed up--you have the </a> before the <a>.
 
Hi guys
Sorry to cut in on your post jamesjames1 i know this is really bad forum etiquette...

Spork i've been searching for an age to try and shrink images being uploaded to my site automatically from a script but don't seem to have got anywhere.

Ideally i don't want to be dependant on thrid party "cheapware". I already have photoshop and fireworks, Paint.Net and Gimp so could possibly use one of those from a script?

Any help would be much appreciated??

Thanks

sugarflux
 
I already have photoshop and fireworks, Paint.Net and Gimp so could possibly use one of those from a script?

Gimp or photoshop might be able to, provided they were installed on the server and you could write WSH scripts to call the scripting functions of the programs.

But it would pretty messy to get working I would think.

other than that, if the server supports .net you could use the .net image class and call the operation from ASP.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Hmmm. thanks Chris. Rather than delve into my personally unknown abyss of .Net a colleague has recommended an open source api ImageMagick which is now doing the trick - just in case anyone else is having the same problems!

After downloading four incorrect versions i've finally got the correct Windows exe (ImageMagick-6.2.5-5-Q16-windows-dll.exe), installed and it's working perfectly.

Called from the CommandLine or asp or vbscript (as well as hundreds of other interfaces) it couldn't be simpler to do what i need. Plus there are thousands of other functions from merging images, creating slideshows and animations to changing the colour or adding text, bluring etc. which i'll probably take a look at as and when i need them!

I'm sorted! Thanks again
sugarflux

 
Hi,

I think I will go for the .NET solution as the hosting company I use offer .Net 2.0 as part of the package and it seems a shame to waste it. The other issue I would have being that its hosted is that I cannot install any software onto the shared server.

Cheers guys

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top