472,110 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

ASP Jpeg

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

Jan 8 '07 #1
1 1750
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"
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 8 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ming | last post: by
3 posts views Thread by Steve Holden | last post: by
16 posts views Thread by David Lauberts | last post: by
10 posts views Thread by rtilley | last post: by
reply views Thread by Jack Wu | last post: by
1 post views Thread by Smokey Grindel | last post: by
1 post views Thread by Joe Cool | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.