• 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?

Renegade

Well-known member
#1
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. :)
 

Brogan

XenForo moderator
Staff member
#2
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.
 

Renegade

Well-known member
#3
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.
 

Brogan

XenForo moderator
Staff member
#4
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?
 

Renegade

Well-known member
#5
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