Generate thumbnails dynamically when generating ASP page?

N

Noozer

Just wondering how I would about doing this... Not sure what I'd enter in
Google to get any hits...

I'm writing an ASP page that will be running on an IIS server under Windows
2000. The page is going to pull some data from a small database (most likely
an MS Access database) and generating a webpage. One of the pieces of info
it will pull is a filename of an image.

How would I go about generating a thumbnail of the image dynamically? I
assume using a DLL on the server, but I've no idea how. It would be great if
it would save the thumbnail and retrieve it instead of having to generate it
on every use.

Any suggestions are appreciated.
 
B

Baho Utot

Just wondering how I would about doing this... Not sure what I'd enter in
Google to get any hits...

I'm writing an ASP page that will be running on an IIS server under Windows
2000. The page is going to pull some data from a small database (most likely
an MS Access database) and generating a webpage. One of the pieces of info
it will pull is a filename of an image.

How would I go about generating a thumbnail of the image dynamically? I
assume using a DLL on the server, but I've no idea how. It would be great if
it would save the thumbnail and retrieve it instead of having to generate it
on every use.

Any suggestions are appreciated.

EXAMPLES
To make a thumbnail of a JPEG image, use:

convert -size 120x120 cockatoo.jpg -resize 120x120
+profile "*" thumbnail.jpg
 
S

SpaceGirl

Baho said:
EXAMPLES
To make a thumbnail of a JPEG image, use:

convert -size 120x120 cockatoo.jpg -resize 120x120
+profile "*" thumbnail.jpg

You cant do that easily. How do you run the convert program on a server!?

Better solution is to use a component, like ASPJpeg. Once installed into
IIS you can convert images/generate thumbnails/rotate/overlay text etc
etc right from inside your ASP scripts. A lot easier if you are already
generating your pages, you can simply have your page generate its own
thumbs too.

www.aspjpeg.com



--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
A

Andy Dingley

How would I go about generating a thumbnail of the image dynamically?

Make the src URL for the thumbnail point to a PHP script on the
server. This is a trival bit of PHP that makes thumbnails by resizing
dynamically.

This is a trivial operation in PHP, which has functions to do it (like
any sensible web scripting language). You can't do it under
ASP/JScript or ASP/VBScript without involving a DLL. DLLs require
wrangling with the server-admin bearded trolls and probably require
buying a commercial DLL, which involves getting the pointy-hairs to
sign something. The PHP software hack is _easier_ than dealing with
the wetware.

(I've had to do this on more than one client site in the past)
 
N

Noozer

How would I go about generating a thumbnail of the image dynamically? I
assume using a DLL on the server, but I've no idea how. It would be great if
it would save the thumbnail and retrieve it instead of having to generate it
on every use.


Thanks for the suggestions folks! Gives me a great place to start. It's
appreciated!
 
S

SpaceGirl

Toby said:
SpaceGirl wrote:




By installing it on the server and then calling it from your ASP pages?

http://www.imagemagick.org/www/windows.html

Ahh okay. Couldn't see anything on their site about how to call the
program once it is installed... but then I've only had 4 hours sleep and
I can hardly see the screen *squint* as it is :(

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
B

Baho Utot

Baho said:
On Sun, 13 Mar 2005 21:13:14 +0000, Noozer wrote:
[putulin]

You cant do that easily. How do you run the convert program on a
server!?

Simple you can call it from PHP, perl, Bash or any CGI for that matter.

for file in *
convert -size 120x120 $file.jpg -resize 120x120 +profile "*" \
$file.thumbnail.jpg
done
 
S

SpaceGirl

Baho said:
Baho said:
On Sun, 13 Mar 2005 21:13:14 +0000, Noozer wrote:
[putulin]


You cant do that easily. How do you run the convert program on a
server!?


Simple you can call it from PHP, perl, Bash or any CGI for that matter.

for file in *
convert -size 120x120 $file.jpg -resize 120x120 +profile "*" \
$file.thumbnail.jpg
done

But not ASP... which is what the OP uses. ASP doesn't have syntax like
that. You can only run programs that have been added in IIS. This is how
you use ASP jpeg:

<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open "c:\path\myimage.jpg"
Jpeg.Width = 60
Jpeg.Height = Jpeg.OriginalHeight * 60 / Jpeg.OriginalWidth
Jpeg.Save "c:\path\thumbnail.jpg"
%>

How would you create an object for this "convert" program in IIS? I dont
understand how the program suggest a) works in IIS (ASP) at all b) is
any simpler than aspJpeg, which is totally self explanitory.


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
T

Toby Inkster

SpaceGirl said:
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open "c:\path\myimage.jpg"
Jpeg.Width = 60
Jpeg.Height = Jpeg.OriginalHeight * 60 / Jpeg.OriginalWidth
Jpeg.Save "c:\path\thumbnail.jpg"
%>

How would you create an object for this "convert" program in IIS? I dont
understand how the program suggest a) works in IIS (ASP) at all b) is
any simpler than aspJpeg, which is totally self explanitory.

From my limited VBScript knowledge, something like this:

<%
Set wshell = Server.CreateObject("wscript.shell")
command = "c:\magick\convert.exe -resize 60 c:\path\in.jpeg c:\path\out.jpeg"
proc = wshell.run(command,0,True)
%>
 
A

Andy Dingley

It was somewhere outside Barstow when SpaceGirl
But not ASP... which is what the OP uses. ASP doesn't have syntax like
that.

No, you can run any exdcutable from ASP.

But any competent server admin should stop you doing this. And if you
try to execute something with a tainted (user entered) filename as
part of it, they should break your fingers. The reasons are obvious.
 
S

SpaceGirl

Toby said:
SpaceGirl wrote:




From my limited VBScript knowledge, something like this:

<%
Set wshell = Server.CreateObject("wscript.shell")
command = "c:\magick\convert.exe -resize 60 c:\path\in.jpeg c:\path\out.jpeg"
proc = wshell.run(command,0,True)
%>

hmmm interesting! I will try it out.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
B

Baho Utot

On Mon, 14 Mar 2005 22:20:27 +0000, SpaceGirl wrote:

[putulin]
How would you create an object for this "convert" program in IIS? I dont
understand how the program suggest a) works in IIS (ASP) at all b) is
any simpler than aspJpeg, which is totally self explanitory.

Left that part as an exercise for the reader :)

I was just trying to get you the think outside the box. Twice now you
implied that "it couldn't be done" twice now you were mis-taken.
There are more than one way of solving the problem....
http://www.apache-asp.org/
 
S

SpaceGirl

Baho said:
On Mon, 14 Mar 2005 22:20:27 +0000, SpaceGirl wrote:

[putulin]

How would you create an object for this "convert" program in IIS? I dont
understand how the program suggest a) works in IIS (ASP) at all b) is
any simpler than aspJpeg, which is totally self explanitory.


Left that part as an exercise for the reader :)

I was just trying to get you the think outside the box. Twice now you
implied that "it couldn't be done" twice now you were mis-taken.
There are more than one way of solving the problem....
http://www.apache-asp.org/

It cannot be done without relaxing the security... I'm not sure if
Apache ASP is mature enough yet?


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top