1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I setup the max width or max height of an image?

Discussion in 'XenForo Development Discussions' started by Renegade, Jun 10, 2011.

  1. Renegade

    Renegade Well-Known Member

    I want to limit the size of the images being displayed on an add-on. If the image is too wide then the max width parameter should limit the dimension but keep the original proportions intact.

    My second question is, how can I resize the image to a set height or width (depending on whichever is higher) while uploading.

    Any guidance is greatly appreciated. :)
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Just set a max width (and height) value in the ACP.

    Options -> Attachments -> Maximum Attachment Image Dimensions

    Any images over those dimensions will be resized down to match, with the ratio being maintained.

    Resizing of smaller images up to the dimensions set in the ACP isn't performed.
     
    Garamond likes this.
  3. Renegade

    Renegade Well-Known Member

    No I don't want to set this throughout the board but for a specific template. That's why I didn't post it in XF support myself.

    On a particular template there is a set of code which outputs the images on a page. I want to set this limitation there.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Is this for an existing add-on or one you are developing?

    I can move the thread to development questions if that's more appropriate?
     
  5. Renegade

    Renegade Well-Known Member

    Not for an existing add-on. Something that I was getting developed and now this particular functionality seems out of scope to the developer. So you can say something that I am developing :p
     

Share This Page