show image in small size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasahmed996
    New Member
    • Jun 2008
    • 160

    show image in small size

    hi to all

    i want to show image on page in fix size of 300*300. images which have size more than that should also show in that size with same picture quality. is it possible? if yes how can i do this. i need to know i am not clear in my question.
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    You don't need PHP. Just define your image sizes in your CSS or HTML. Let me know if I have misunderstood.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      You can either simply set the image size in your HTML or CSS, which would instruct the browser to download the full-size image and resize it for you. (Which works pretty well in all browsers except IE, which does an awful job at resizing them)

      Or, you can have PHP resize it before it sends it to the browser.
      See the imagecopyresamp led function for that.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        You would have to take into account 'constraining' the image proportions. A file that is 500*1000 will not resize gracefully into 300*300.

        Comment

        • xaxis
          New Member
          • Feb 2009
          • 15

          #5
          If you are down sizing an image its "quality" will degrade no matter what simply because there will be fewer pixels/per area and thus less detail. It has been mentioned above, but you will indeed need to pay attention to the aspect ratio of the image.
          Indeed using HTML or CSS will resize your image however different browsers have certain compatibility quirks so I would recommend you re-sample the image with PHP in order to produce consistent cross browser results.

          my2cents

          Comment

          Working...