HTML/DHTML/Scripting & Image gurus...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acctman
    Confirmed User
    • Oct 2003
    • 2840

    #1

    HTML/DHTML/Scripting & Image gurus...

    I think my subject covered everyone that could possibly help. I have a question, does anyone know how to scale an image maintaining the aspect ratio of the image, with or close to 350h or 350w? I don't want to change the original image at.

    Is there a HTML, DHTML or Script that will force a image to be displayed with a set ratio dimension?

    I want to be able to load images into a table cell and not have to resize the images manually before hand, since users will be automatically uploading images.
  • juicylinks
    So Fucking Banned
    • Apr 2001
    • 122992

    #2
    photoshop

    Comment

    • dotwind
      Confirmed User
      • Dec 2003
      • 285

      #3
      you can even just set the width and height in the img tag that would show it with the desired width and height if you wanna keep the ratio i don't think hahahahahahahahahaha can do that i didn't look into it but it can be done easily with a server side script.

      DW
      Custom large/complex systems programing.<br>ASP.Net, C#, XML, MS SQL, WebServices(SOAP).<br>ICQ: 235719545

      Comment

      • pornanza
        Confirmed User
        • Jul 2003
        • 238

        #4
        you can just set &ltimg src="" width="350"&gt but each user will be downloading the full image = slow & more bandwidth

        the following code will thumbnail the image

        PHP Code:
        
         function resize($width, $image, $photoFolder, $thumbFolder) {
          $size = getimagesize("$photoFolder/$image");
        
          $length = ($size[1] * round($width / $size[0] * 100)) / 100;
        
          if ($length > $width) { $length = $width; $width = ($size[0] * round($length / $size[1] * 100)) / 100; }
        
          $source = imagecreatefromjpeg("$photoFolder/$image");
          $destination = imagecreatetruecolor($width, $length);
        
          imagecopyresampled($destination, $source, 0, 0, 0, 0, $width, $length, $size[0], $size[1]);
          imagejpeg($destination, "$thumbFolder/$image", 75);
         } 
        
        ryan
        Eskimo Hoe
        QuickWank
        Pornanza!

        Comment

        Working...