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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resample image in asp 1

Status
Not open for further replies.

Smarty

Programmer
Apr 12, 2001
191
BE
Hi,

I'm not sure if it is possible, but it is a challenge anyhow:

Is there a possibility to resize and resample images in ASP. This will solve the following issue: I have a bunch of images in press-quality (300dpi, 3000Kb a piece), and I want my users to dynamically create a picture book website. So I can display those images (intranet, high speed) by displaying every image file in a specific directory, and then processing the radiobuttons under each image. I would like to create a smaller picture (width=350) and save them in a different directory. By creating a database which holds the different locations, a picture book can be created automatically. Only how do I resize those images?

And if you know how to display al jpegs in a specific directory, this would be helpfull to.

Kind regards,
Smarty
 
It is possible but not in pure ASP - you'll need external component/program to do that.

> And if you know how to display al jpegs in a specific directory, this would be helpfull to.

Try this. Note: oFile.type is descriptive string (language-dependent)

Code:
<%	showDirectoryImages( "img/" )

Sub showDirectoryImages( sDir )
	Dim oFSO: Set oFSO = Server.createObject( "Scripting.FilesystemObject" )
	Dim oFolder: Set oFolder = oFSO.getFolder( Server.mapPath( sDir ) )
	Dim oFile
	
	For Each oFile in oFolder.files
		If oFile.type = "JPEG Image" Then response.write "<img src='" & sDir & oFile.name & "'>"
	Next
	
	Set oFolder = nothing
	Set oFSO = nothing
End Sub
%>

 
Displaying All Images: You can loop through all files in a specific folder using the FileSystemObject to get the folder and then looping through it's collection of Files. Just check that the file extension in the name is jpg or jpeg and you will have all your jpegs.

Image resampling is a bit more complicated. There are a large number of COM compenents available for this (Hit up google). I have only seen a couple Pure ASP solutions to resizing/resampling images and while I used to have a partiulary good one saved to my local machine I lost it at some point. My best guess would either be someone elses response or, again, a google search based on "pure asp image manipulation"

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Thanx, this solved part 2.
Someone for part 1?
Or part 1b, how can you know the width and heigth of an image in asp (so that I can decide to use the width or height argument to display landscape and portrait files)?
 
OK, is there someone who knows a free, and easy to use 3rd party component?
 
Don't know about a free one, but Persits has a cheap component that works brilliantly, go to We have a gallery section on our Intranet that has the thumbnails built on the fly by the aspjpeg component (the gallery is just a shared network drive that users dump JPG files into).
 
Another vote for Persists aspjpeg. We used that and ASPUpload for a website that allows field people to upload digital photos. We use aspjpeg to resize, create thumbnails and add copyright text to each image. GREAT PRODUCT.

TR
 
If your server supports .net runtime there are several (free) sample programs that do the whole job you require.
 
the .net runtime is present, but I only can program asp...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top