I have a page where users can upload images, but sometimes the images are too small. How can get the height and width (in pixels) for an image? I've seen it done in PHP but never in ASP.
Does anybody know of a way to get an image width and height without using a custom dll? we have aspJPEG on the server, and there are methods to fetch image width and height with that, but it only works with JPEG and i need to get dimensions for gif and png, too.
I have an ASP page which displays different images according to the querystring and the images are all of different sizes. However, in some browsers the image overlaps with the text next to it occasionally.
I guess by specifying the "width" and "height" of the image in the HTML should solve the problem. However, I do not want to store the width and height of each image in the database. (There are too many of them!) Is there any function I can use in my ASP page to obtain the width and height of an image?
I know there must be a JavaScript way, but is there a VBScript way? I asked here, because if there's a javascript way I need to also use VB with it...since I want to trim an image if it's over a certain size...
Is there Javascript that you can run where it limits the width of an image. For example:
All images that are under 400px wide will display at their native size but if an image exceeds 400px wide it will get scaled proportionly to 400 px wide and however many pxs high (to maintain proportion).
sidenote: images will be populated on page from a database.
I have a popup where I scale the image to a smaller size than original. Iused to set the img tag to width="50%". This no longer works in the current edition of IE on MS. On Mac IE it still does. Go figure.
So... I now need to set the width to a fixed value. I also need to adjust the popup to the value of the image height + some value to allow for text etc.
The quandry? How can I get the height and width of an image into a variable for use on the calling asp page.
I'm creating a forum based site with basic BBCode features, but am concerned that misuse of the [ img ] tag will mess up my layout. I do not want to go down to road of users uploading images, but want to allow them to embed images from flickr, photobucket etc.
So, is it possible to restrict all linked images that are say, over 400 pixels wide? I've been racking my brains and have had trouble coming up with any solutions. Is it possible?
I'm trying to read in image data using the filesystemobject. I am able to read the comments field for all file types it seems, except the ones I want, .gif .jpg and .bmp.
Is it possible to do this?! If so what might I need to do? Code:
I am developing an web application, it should has the function to upload file from client computer. The uploaded file size can be limited within 10 MB.
But I dont know how to check the size of the file on client-side. Server-side size check is not enough, because it can not be checked until the whole file is received while the server resource(cpu,memory etc) is wasted.
I am having a problem with this code. The problem I am facing is that the first image is displayed in its original size. But when I click the next button, the next image not displayed in its original size, but being displayed as 100 x 100 pixels, same goes to the 3rd picture and so on. Code:
I only need to know the height and width of the image.
It doesn't seem to be as easy as php's "getimagesize($imgFile);" method.
<% 'Copyright *c* MM, Mike Shaffer 'ALL RIGHTS RESERVED WORLDWIDE 'Permission is granted to use this code 'in your projects, as long as this blah 'copyright notice is included
function GetBytes(flnm, offset, bytes) Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFTemp = objFSO.GetFile(flnm) lngSize = objFTemp.Size set objFTemp = nothing
Set objTextStream = objFSO.OpenTextFile(flnm,1) strBuff = objTextStream.Read(offset - 1) GetBytes = objTextStream.Read(bytes) objTextStream.Close set objTextStream = nothing set objFSO = nothing end function
function lngConvert(strTemp) lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256))) end function function lngConvert2(strTemp) lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256))) end function
function gfxSpex(flnm, width, height) fileT=split(flnm,".") if fileT(1)="gif" then Width = lngConvert(GetBytes(flnm, 7, 2)) Height = lngConvert(GetBytes(flnm, 9, 2)) elseif fileT(1)="bmp" then Width = lngConvert(GetBytes(flnm, 19, 2)) Height = lngConvert(GetBytes(flnm, 23, 2)) elseif fileT(1)="png" then Width = lngConvert2(GetBytes(flnm, 19, 2)) Height = lngConvert2(GetBytes(flnm, 23, 2)) end if gfxSpex=true end function
if gfxSpex("images/urlogo.gif", w, h) = true then response.write w & " x " & h end if %>
Which is a little bit shorter, and seems to work ok so far, but isn't there anything easier, like php's "getimagesize($imgFile);"?
i have a page that displays an image. the image path is a variable passed in the url link. eg. enlarge.asp?picture=http://www.hey/.com/you.jpg and the window it opens works. but id like to try and get the enlarge as to get the height and width dimentions so i can call a new window to opena popup and ill dynamically have the images dimentions to scale the popup to fit. and right after the javascript calls a new popup window itll use a close window function. and since it happens before the head tags it should be seamless as if i had a regular link calling a popup.
I have a table full of pictures with urls to images. Any idea how I could find out the dimensions of the images? i want to design tables to show them in a better way.
is it possible to have an asp script create a thumbnail of an image upon upload?
i want to create a rather small thumbnail and 65 x 83 and put it in a folder '/sized'
oh yeah, and one more quick thing.. i am pulling information from a database.. why is it that the symbol ' gets changed to a ? when pulling it from the field.. will this go away when i start adding information through forms instead of access?
The pic in the DB is just a named reference, as all the pics are stored in 2 common folders. 1 for the normal size pics and 1 for the thumbnail equivalents.
As this particular page has to be tight on space, I wanted to set the image as a percentage of it's size so I set the following:
Problem I have with this is that the browser seems to set all pics to 1 common percentage size rather than each being say 30% of each individual pic's size. This results in some piccies being completely distorted.
I don't want to go down the route of storing the x and y of each pic in the DB, so could you please let me know if I am doing something really stupid with the above.
My ASP app dynamically retrieves from db and sends JPG images using Response.BinaryWrite(). And it seems work. The script sets image type as "Response.ContentType = 'image/JPEG';"
But viewing image properties in IE returns Type and Size as 'Not available'.
Is there any routine I can call to reduce the size of an image file after uploading a file from a client. I am looking to reduce file sizes programmatically using C# in my web page after uploading. I know that Photoshop can do it but I need to do it dynamically in my web page. I tried doing it myself with some of the Bitmap thumbnail instructions but the resulting image is very bad. I need a file reduction routine that creates a good image that is smaller. I figured if Photoshop can do it then so can I but how?
I am writing a little script for an online album. The pictures' size varies a lot. I have a maxim size for every displayed picture because the layout of the page. So I want to resize the larger one to that size while leave the smaller one in their original size. Is there any script or code that can do this automatically?
I have an photo gallery, I want to create a button that opens a new window fixing the full size image snugley in it, which is easy.
But I want to get a script which detects the image size so i can use the variables to open the window.
What i want to not do is have to more options in the database with height and width in, and have to call them, although i'll do that if i have to, but i thought i would try something new.
I am working on a image gallery and am trying to show images from different websites. Before I display an image I need to know whether that image exists on the other server and only display it if it exists.