ASP Jpeg

B

Brett_A

I have the following code:

*************************************

SavePath = Path & "\thumb_" & File.ExtractFileName

' AspJpeg always generates thumbnails in JPEG format.
' If the original file was not a JPEG, append .JPG ext.
If UCase(Right(SavePath, 3)) <> "JPG" Then
SavePath = SavePath & ".jpg"
End If

jpeg.Save SavePath

*************************************

As the comments indicate, the thumbnails are created as .jpg files and
must be saved accordingly. Unfortunately, if the user uploads a .gif
file, the code above (taken directly from Persists web site) does not
remove the .gif extension and add the .jpg extension, it appends the
..jpg on the end of the file name, giving something like this.

thumb_porsche_911.gif.jpg

What would the code be to strip the .gif so that this line:

SavePath = SavePath & ".jpg"

creates the desired file name?

Thanks.

Brett
 
E

Evertjan.

Brett_A wrote on 08 jan 2007 in microsoft.public.inetserver.asp.general:
I have the following code:

*************************************

SavePath = Path & "\thumb_" & File.ExtractFileName

' AspJpeg always generates thumbnails in JPEG format.
' If the original file was not a JPEG, append .JPG ext.
If UCase(Right(SavePath, 3)) <> "JPG" Then
SavePath = SavePath & ".jpg"
End If

jpeg.Save SavePath

*************************************

As the comments indicate, the thumbnails are created as .jpg files and
must be saved accordingly. Unfortunately, if the user uploads a .gif
file, the code above (taken directly from Persists web site) does not
remove the .gif extension and add the .jpg extension, it appends the
.jpg on the end of the file name, giving something like this.

thumb_porsche_911.gif.jpg

What would the code be to strip the .gif so that this line:

SavePath = SavePath & ".jpg"

creates the desired file name?

temp = lcase(right(SavePath,4))
if temp = ".gif" or temp = ".jpg" then
SavePath = left(SavePath,len(SavePath)-4)
end if
SavePath = SavePath & ".jpg"
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top