Web Wiz - Green Windows Web Hosting - Celebrating 25 Years!

  New Posts New Posts RSS Feed - ASPImage Image Resize Re-Size
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASPImage Image Resize Re-Size

 Post Reply Post Reply
Author
JohnnySlotCar View Drop Down
Newbie
Newbie
Avatar

Joined: 15 September 2003
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnnySlotCar Quote  Post ReplyReply Direct Link To This Post Topic: ASPImage Image Resize Re-Size
    Posted: 27 September 2003 at 12:56pm

Has anyone gotten ASPImage 2.0 to work as an uploaded image file resizer?  If so, could you share code?

Thanks in advance - looking for ways to limit my uploaded images to 390px wide.

Johnny

Back to Top
Corobori View Drop Down
Newbie
Newbie


Joined: 20 August 2003
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Corobori Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2003 at 3:13pm

Look at the code shown below, this load an image using SA File UP then makes two pics of it a bigger and a smaller one.

I have a slightly more complicated sample showing how to use ASPImage to cut off parts of an image, draw a circle, write a text here: http://www.corobori.com/Image.asp

cSizeBigPic=500
cSizeSmallPic=250

sFileName0n = "REG" & lRe_Id & "."   &  Mid(upl.Form("fi_ImageToUpload").UserFilename, InstrRev(upl.Form("fi_ImageToUpload").UserFilename, ".") + 1)   
sFileName1n = Server.Mappath("../Pics") & "\"   & sFileName0n
sFileName0p = "REC" & lRe_Id & "."   &  Mid(upl.Form("fi_ImageToUpload").UserFilename, InstrRev(upl.Form("fi_ImageToUpload").UserFilename, ".") + 1)
sFileName1p = Server.Mappath("../Pics") & "\"   & sFileName0p
         
'on error resume next
'upl.Delete sFileName1
Err=0
          
upl.Form("fi_ImageToUpload").SaveAs sFileName1n
            
Set Image = Server.CreateObject("AspImage.Image")
Image.LoadImage (sFileName1n)

image.GetImageFileSize sFileName1n,iX,iY
                                
if cint(iX) > cSizeBigPic then
    intYSize = (cSizeBigPic / Image.MaxX) * Image.MaxY
 Image.ResizeR cSizeBigPic, intYSize

end if
image.FileName = sFileName1n
   
image.SaveImage
               
image.LoadImage (sFileName1n)

image.GetImageFileSize sFileName1n,iX,iY
                                
if cint(iX) > cSizeSmallPic then
    intYSize = (cSizeSmallPic / Image.MaxX) * Image.MaxY
    Image.ResizeR cSizeSmallPic intYSize

end if
image.FileName = sFileName1p
   
image.SaveImage       &nb sp; 
                            
if Err <> 0 Then 
 sError = err.description  & " " & Err.number & "<BR>"
else
 sSQL = " UPDATE tblMYtable "
 sSQL = sSQL & " SET    Re_ImageSmall ='" & sFileName0p & "', "
 sSQL = sSQL & "        Re_ImageBig ='" & sFileName0n & "' "
 sSQL = sSQL & " WHERE Re_Id = " & lRe_Id
 Set cmdTemp.ActiveConnection = conCorpocas
 cmdTemp.CommandText = sSQL
   
 on error resume next
 cmdTemp.Execute 
 if Err <> 0 Then 
  sError = err.description  & " " & Err.number & "<BR>"
 end if
end if


 

Back to Top
JohnnySlotCar View Drop Down
Newbie
Newbie
Avatar

Joined: 15 September 2003
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnnySlotCar Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2003 at 9:36am

I appreciate both pieces of code!  My ISP only supports ASPImage 2.0 at the moment, but I see what you're doing in the prev. message...

May be you can help me with this ASPImage code.  I have placed the following in upload_images.asp, on about line 190-200 (right above the 'post back' statement):

'###################################

Dim Image

Set Image = Server.CreateObject("ASPImage.Image")

Dim intXSize
Dim intYSize
intXSize= 390

Image.LoadImage strFileUploadPath & "strImageName"
Image.FileName = strFileUploadPath & "strImageName"
Image.ImageFormat = 1
Image.JPEGQuality = 60

intYSize = (intXSize / Image.MaxX) * Image.MaxY

Image.ResizeR intXSize, intYSize

Image.SaveImage

Set Image = nothing

'###################################

My file still uploads, but no resizing.  The intYSize should support proportional resizing according to the docs - can anyone help with this?  Again, I am trying to resize uploaded images to 390px wide.

Thanks in advance!

Johnny
http://www.shoost.com/JohnnySlotCar

 

Back to Top
martionline View Drop Down
Groupie
Groupie


Joined: 13 January 2005
Location: Turkey
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote martionline Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2005 at 5:54pm
plz i need this code too help about aspimage
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.