dynamically get dimensions of graphic

Results 1 to 3 of 3

Thread: dynamically get dimensions of graphic

  1. #1
    omc Guest

    Default dynamically get dimensions of graphic

    Say my users are going to be uploading images to go along with products in a database. I can suggest to them to send me images that are 400 pixels wide, but I can&#039t force them to do that. If someone uploads an image that is 1000 pixels wide it is going to be too large to be useful.<BR><BR>I am hoping to do some validation in the code before I display the image. If I can find out the dimensions of the images on the fly I could say <BR>(psudocode)<BR>if image width &#062; 400 then<BR>&#060;img src=name.gif width=400&#062;<BR>else<BR>&#060;img=name.gif&#062 ;<BR>end if<BR><BR>Does anyone know if it is possible to get the dimensions on the fly?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: dynamically get dimensions of graphic

    There is a problem with this. If you are going to display the image specifing a size other than it&#039s actual size will distort the image. If you take an image which is 1000pxls wide and try to say in you HTML it is 400pxls wide it will not look like you want. You either have to specify the correct size or no size.

  3. #3
    omc Guest

    Default RE: dynamically get dimensions of graphic

    No, that should be ok. If you just specify the width and not the height it will resize the image proportionally. But if I ran into a problem doing that I could always just perform a calculation evenly on the two dimensions. I&#039m sure I can work that out if I can get the dimension of the image before displaying it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts