SEARCH YOUR SOLUTION HERE  

Resize the image and save problem

I have problem with resizing a picture and don't know what the problem with the following code:

dim fs
dim sourcefile
sourcefile = uploadsDirVar & filename
set fs=Server.CreateObject("Scripting.FileSystemObject ")

'to access the data of the image
dim iwidth, iHeight
dim myImg

if fs.fileExists(sourcefile) then
set myImg = loadpicture(sourcefile)
iwidth = round(myImg.width / 26.4583)
iHeight = round(myImg.height / 26.4583)

if (iwidth > 250) then
iHeight = (iHeight * 250)/iwidth
iwidth = 250
end if

If (myImg.Width > iwidth) or (myImg.Height > iHeight) Then
If (myImg.Width / iwidth) > (myImg.Height / iHeight) Then
myImg.Resize iwidth, 0
Else
myImg.Resize 0, iHeight
End If
End If

myImg.WriteFile sourcefile
set myImg = nothing
end if

set fs=nothing



when i run it, the following error occur :

Object doesn't support this property or method: 'myImg.Resize'

Can anyone help me

Posted On: Friday 26th of October 2012 04:09:15 AM Total Views:  313
View Complete with Replies




Related Messages:

How to resize an image with the binary data   (183 Views)
I would like to avoid using a 3rd party function, and do not want to render the browser tag (width), but would like to grab the binary data of the image file with the filesystemobject and resize it on the fly. Is it possible like this Otherwise, What is the best method for this I wasn't able to find any info online about it.
image resize   (154 Views)
hey, im looking for a script to resize the images i upload (So basically they'll load faster when displayed/decrease image size) i found this one : ASP image resize and jpg/gif/png convert, free VBScript code but i didn't quite understand how to implement it, what excactly needs to be done they dont have this resizing/outformat stuff in their download section either... any ideas
Image resize   (155 Views)
Has anyone managed to get ASP to do an image resize I know its possible easily in .NET, or by purchasing a COM object, but my server cant have either of those. Looking to automatically create a thumbnail when a user uploads an image.
Automatic resize new uploaded jpeg in folders   (148 Views)
Moved to .NET forum
Automatic resize new uploaded jpeg in folders   (180 Views)
Moved to .NET forum
Image resize in browser   (136 Views)
I have an ASP page where I am displaying an image submitted by a user. I don't know the width or height of the image - they are variable. However, when I display the image, I want to shrink it to a particular size if it is wider than one of my page elements (say, 130 pixels). I need to detect the width of the image and then display it with a WIDTH attribute if it is wider than 130 pixels. Anyone know a way to do this with ASP, without using a 3rd party component If not, know how to do it with Javascript
VBScript - General - Question - AspUpload resize image and save   (151 Views)
I have searched the web for a working asp example of uploading a file ....then take the same image and resize it and save it ...but I only find references to aspupload can do it but no examples of how this is done. If someone has a working example of how to do this and will share, I would appreciate it very much.
Auto resize picture   (136 Views)
Hi... I have a web page which'll allow a user upload pictures. Problem is, different users have different sizes of pictures. I was wondering if there was a way to auto resize the picture when upload to the server I googled around but all i got were sites which had components that would help me do just that. I don't want to use components, just want to use pure ASP (or maybe js). help appreciated.
imageMagick 2 images resize or more... help   (172 Views)
help-me please resize 2 images in 2 other images but i cant help me please the script to resize 1 image in other image is this: but icant make 2 or more code::: if you can make this ...say me please
image resize   (181 Views)
I have a page that displays a image from a folder. If the image is over a certain size I want to resize it to a given size, but if the image is smaller than the given size I set I want it to stay the same. Any ideas
Image resize   (199 Views)
Hi ,In PHP there is a handy little function in PHP:list($width, $height, $type, $attr) = getimagesize("image_name.jpg");This will get the image width, height and file type.Is there any way of getting this information using ASPI have no access to the software on the server so cannot install any ancillery software.I am now desperate to find a solution so any help or advice would be greatly appreciated!
list all images in a folder and resize if wider than xx pixels.   (175 Views)
I want to give the user an image assets page... where the user (who is using an home-brew CMS solution to manage content for a site) is able to click to view 'all available images' that they can insert into the content they are posting... I would like to have this based on all images within a specific folder (all will be jpegs)... so on the simple one-page that lists them all out for the user, Im trying to figure out how to a) list them all out verticallyb) for images that are TALLER than xx pixels, I want to determine the width and height then divide both those by 2 (to resize the down to a smaller version)Is this do-able here is the code Im using successfully to show all the images in a folder... CODEDim oFilesys, oFolder, oFileSet oFilesys= CreateObject("Scripting.FileSystemObject")Set oFolder= oFilesys.GetFolder(Server.MapPath("../../images"))For Each oFile in oFolder.Files'Response.write ""'Response.write ""thisimg="../../images/"&oFile.Name%>
Image resize on upload progress...   (194 Views)
hi im using shadow upload and the shadow resizer just wondering how im doing with the below code as it all wrong or on the right track Code: Response.Write("file name: "&objUpload.File(x).FileName&"") Response.Write("file type: "&objUpload.File(x).ContentType&"") Response.Write("file size: "&objUpload.File(x).Size&"") If objUpload.File(x).ContentType = "types of image go here" then Response.Write("image width: "&objUpload.File(x).ImageWidth&"") Response.Write("image height: "&objUpload.File(x).ImageHeight&"") If (objUpload.File(x).ImageWidth>200) Then Dim strPath, strImageName, strThumbName, objXML strPath = "/admin/news/uploads/" strImageName = objUpload.File(x).FileName strThumbName = objUpload.File(x).FileName Set objXML = Server.CreateObject("Microsoft.XMLHTTP") objXML.Open "GET", "http://localhost/ImageResizer.aspximage=" & strPath & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width200&height=-1", True objXML.Send Set objXML=Nothing Response.Write("original: ") Response.Write("thumbnail: ") Else End If Else End If what im trying to do is check if one of the files uploaded are an image, jpg, jpeg, png, gif etc then if they are check the size if the size is greater than 200px in width then resize the image to 200px width constraining proportions how is the above looking cheers
Is posible to resize an Image without any component   (161 Views)
I am trying to resize images without componts in ASP, but I couldent find anything that can do that. Maybe I am asking to much from just ASP. Thank a lot.
Picture resize and upload using ASP   (208 Views)
Hi Guys, I have a web page which'll allow a user upload some pictures. Problem is, different users have different sizes of pictures. I was wondering if there was a way to resize the picture just before it is saved on the server If not, then is there a way of resizing it just when i'm about to display it I googled around a bit but all i got were sites which had components that would help me do just that. I don't want to use components cos my host won't allow me use any external components, just want to use pure ASP (or maybe js). help appreciated.
resize image in asp   (197 Views)
can somebody show me the code to resize image in asp
ShadowUploader - resize the uploaded images on the fly   (327 Views)
(regarding this thread: http://forums.aspfree.com/code-bank-...res-94647.html) Originally Posted by Shadow Wizard nope, classic ASP has its limits, that's one of them... you'll have to install and use some 3rd party component for this, or better yet - switch to ASP.NET where it's possible using simple code. Could you please tell me where can I find the script (in asp.net) which can re-size the image height and width
AspSimpleUpload - rename and resize?   (172 Views)
does anyone know how to rename and resize images in aspSimpleUpload
image resize   (282 Views)
please i need some help with this.. How can i resize a picture with asp, i mean i store the picture into the database, and when i display it, i just resize it from html, but it does not look good, not focused... basically how can you make a thumbnail.. Thank you
asp dynamic images   (258 Views)
hola first post, so go easy on me! i'm trying to create a function that will return an image of a specified width and height. rather than simply resizing an image and retaining its fat filesize, is there a way to create images on the fly from an original i know it is possible in php, but the server i am working on doesn't have it! cheers in advance vince