Dear all,

I have written the webpage for picture update with definite size (width="240" height="160"). However, if the user updates the picture with the dimension ratio not 240/160, the picture will be deformed. Please give me reply how to show the picture resizing with respect to the dimension ratio of the picture itself, within the frame of dimension 240*160. Thanks

Simon

    I'm not sure excattly what you are doing, but maybe you could take the image width and height(if they are uploading through a php script). Run a loop on each height and width.

    do {
    $image_width = $image_width/1.12;
    $image_height = $image_height/1.1;
    } while($image_width > 240);

    do {
    $image_width = $image_width/1.1;
    $image_height = $image_height/1.1;
    } while($image_height > 160);

    i've never done something like this but i'm guessing something like that may work.

      Are you saying that your website's users can change the size of an existing image?

      If so, what is the input? A maximum size, a specific x and y size?

      Are you using ImageMagik?

      Just need a little more info. Not sure what you mean. 🙂

      Sersun

      PHP-MySQL Hosting $10 Month
      www.missoulaweb.com

        no, i think when a user uploads and image, php creates varaibles for the width and height. (i think image magik can actually resize the pictures) but i thought you could just put the adjusted width and height in the <img> tag to display the image in the place you wanted to. You could store the image name - adjusted width and height in a database and call those out.

        this was just a quick late night thought actually, not sure if this is a good solution.

          Write a Reply...