|
-
May 25th, 2000, 02:56 AM
#1
Thread Starter
Addicted Member
I've searched many ASP sites, but none seem to say much on this topic:
How to create a dynamic thumbnail page on the fly in ASP?
Could someone point me in the right direction?
Thanks.
-
May 25th, 2000, 06:43 PM
#2
Frenzied Member
This is possibly halfway there...
ok maybe not! 
Code:
<%@ Language=VBScript %>
<html>
<%
Set fileIO = CreateObject("Scripting.FileSystemObject")
path=Server.Mappath("./images/")
Set Dir=fileIO.GetFolder(path)
Set FileCollect=Dir.Files
For Each item in FileCollect
if isPic(item.name) then
Response.Write("<IMG SRC='" & "./images/" & item.name & "' WIDTH = 100 height = 100 >")
end if
Next
set fileIO=Nothing
function IsPic(filename)
'Response.Write filename
select case lcase(right(filename,4))
case ".gif",".jpg","jpeg"
IsPic = true
case else
IsPic = false
end select
end function
%>
</html>
-
May 25th, 2000, 10:05 PM
#3
Lively Member
Hmm ive been giving this some thought too
Ive been thinking about this as well, someone told me just to make the
Response.Write("<IMG SRC='" & "./images/" & item.name & "' WIDTH = 20 height = 20 >")
this would make the image smaller.
then inluce a link the regular picture. I also found an article that could help you to judge how big a picture is:
i belive the link is http://www.aspcode.com/
Keep me informed i want to impliment this on my website
-
May 25th, 2000, 10:18 PM
#4
Thread Starter
Addicted Member
thanks for the code mark.
scott: yes, i've thought about doing the same. Two concerns:
1) I want to preserve the aspect ratio. It would be easy to do, if I could access the height and width properties of the original image. Anyone know how to do this?
2) This is not in fact the optimal solution. When you simply redefine the height and width tags, all it does is download the entire image, but just resizes it on the client's browser. This can be a drain on server ressources, and (more importantly) your pages won't load any faster! We have to come up with a way of processing the image on the fly... I'm open for suggestions!
-
May 26th, 2000, 12:39 AM
#5
Lively Member
To understand what i want to do:
Im going to have an upload component so that users could upload picture onto the server
Then i want to sort them by alumn. for example a user could have their own photo alumn and when the go to it all the pictures would come up in a thumbnail.
Then i wanted to be able to do a slideshow if they wish.
Does this sound similar to what you want to do, if so we can work on differnt parts and try to get this cranked out.
Scott
-
May 26th, 2000, 01:17 AM
#6
Thread Starter
Addicted Member
Scott: two heads will definitely be better than one!
I want to do something very similar, but I do not require sorting by album.
I'll tell you what I have dug up on my own so far:
First let me elaborate on how I am doing the file submission:
I'm getting the user to browse for the file on his system.
I then use a product called ASPUpload to do the upload. (www.persits.com). But here I do something a little different. I am expecting large amounts of pictures, so I do not want to put them directly in my database. This may bog the system down. Instead what I do, is only store the filename (the path where I'm storing them) in the database. Then I go ahead and save it to the server's HD at that path.
I already have the asp code worked out to go into the image directly and loop through all the files and display them in a table. The only step I'm missing is the reduction of the image before it gets put on the browser.
To do this, I have thought to use an external thumbnail maker program. (au2Thumbs Pro -- http://www.filehouse.com). With this proggy I can apparently make the thumbnails from the command line. ***But this is where I am stuck, and I need you to help me out:
**We have to figure out how to launch a server-sider application (i.e. and exectuable .exe file) from ASP (or more precisely, VBScript). Can it be done? I sure hope so!
Why? because once we can do that, then we could use something like the following
c:\progs\au2\au2thumbs /opt1 /opt2 /type /bla bla
So then, when we want to display our table of images, we just pipe each image through this program, and then display the newly created thumbnail.
It's the only scheme I could think of... please let me know ASAP what you think, and what you can find out!
Thanks man.
(e-mail me at [email protected] if you want)
-
May 26th, 2000, 02:19 AM
#7
Lively Member
This is where the article is to determine the image properties. Im using a hosting service so i cant put any custom built componenets out there, got do it all from asp. I can use the download component through, thats supported by the hosting service.
http://www.aspcode.com/display.asp?id=106
http://www.4guysfromrolla.com/webtech/050300-1.shtml
Regards,
Scott
-
May 26th, 2000, 02:55 AM
#8
Thread Starter
Addicted Member
thanks man.
but the first link didn't work.
please let me know if you find out anything about calling a .exe program from ASP.
thanks again,
mat.
-
May 26th, 2000, 04:09 AM
#9
you can create an activeX dll that calls your server program
What image file formats are you working with?
-
May 26th, 2000, 08:27 AM
#10
Thread Starter
Addicted Member
hmm not sure about writing an activex dll.. i will have to look into that.. thanks
i'm dealing with .gif and .jpg
-
May 30th, 2000, 08:25 PM
#11
Thread Starter
Addicted Member
hi scott.
i settled for displaying my thumbnails by simply reducing them... I know this is not optimal solution, but I'm on a LAN, so speed not really big issue.
But I did have to get around a problem with that:
I have the full size images on the server. I want to display them in reduced form. So I specify a new width, of say 50 pixels. But I want to preserve the apect ratio... how to do it??
Well I downloaded a component called ImageObject which lets me determine Image properties such as height and width.
Once I extracted the height and width of the original image, I was set... Now my dynamic table of 'thumbnails' is working fine.
However, I have not completely sidelined the idea of producing actual thumbnailed images dynamically. In another thread ("Calling a Server Side App") MarkS posted some great code for making a dll that will call my thumbailing app. I tried it, and the app starts, but I have not yet determined if I can pass in command line parameters...will try later today!
That's where I'm at... let me know what you've been up to/
d
-
May 30th, 2000, 08:38 PM
#12
Thread Starter
Addicted Member
i just tried passing command line arguments and it worked.
the app started and pumped out my thumbnails flawlessly.
I implemented the dll that I mentioned above, and this is my asp code:
Code:
<%
dim obj
set obj = server.CreateObject("Project1.Class1")
Response.Write("Error Code: " & obj.runexe("C:\Program Files\Au2Thmpr\au2thmpr.exe /imagedir="&chr(34)&"c:\temp1\images\"&chr(34)& " /thumbdir="&chr(34)&"c:\temp1\thumb\"&chr(34) ))
%>
I can give you more complete code (with the dynamic table generation) if you want.
When you said you are using a hosting service, what exactly does that mean. And does that completely rule out doing what I did? Consider running your own server?
Because I really do think you will need the help of outside components if you want to get this working. ASP seems to be pretty modular. What it can't do, there is most likely a component out there that can do it, or you can write your own...
d8
-
May 31st, 2000, 12:34 AM
#13
Lively Member
Im using softcomca to host my site, therefore i have to use whatever comonents they have on the servers, and i dont think they have any image ones. I can use a dll but it cant be one that has to be registerd on the server so that sort of limits me. I guess i will try to use that code to judge the size of the image and display my images that way.
Scott
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|