Image Upload - Exact Dimensions

4 posts by 3 authors in: Forums > CMS Builder
Last Post: September 24, 2013   (RSS)

Go to Section Edtors, open the section and then click modify on the image field, and then look for the Advanced Options section. Within these options you can specify a max width and height for the images. 

Images that are larger than these dimensions will be sized down proportionately to fit within the specified dimensions.

Images that area smaller will not be resized.

Something you may want to do is to hardcode the preferred image dimensions into the html. This way no matter what size image they upload, it will insure that the layout is not broken.

Yes, I'm familiar with that - thanks though. I've also taken hard code route with dimensions in the html output, but that would still skew the image.

I don't think it exists, but I'm looking to require exact dimensions for an image upload field.

By Jason - September 24, 2013

Hi,

Thanks for posting.  Currently, there isn't a built in way to require images to have exact dimensions.  The easiest work around and this point, would be to set the resizes to be what you want the exact image size to be, then hard code those values into the image tag output.  This should help to limit image skewing to a minimum.  However, if they upload an image smaller than those values, or something that is far from what you were expecting (800 x 100 for example), this probably won't give the results you're looking for.

The best option for requiring certain dimensions would be to create a custom plugin that would look at the image before saving the upload.  There would be a few options for what we could require,  such as:

  1. Exact dimensions (ie, 800 x 600) - this would be the most restrictive
  2. Minimum dimensions (ie, at least 800 wide and at least 600 tall)
  3. Exact Ratio - for example, the width to height ratio must be 2:1.  In this example an image that was 200 x 100 would be okay, but an image that was 600 x 200 would be rejected.

We could also do a combination of these requirements.  For your case, a combination of options 2 and 3 may give the best results will not being too restrictive.

If you are interested in this, please send in an email to consulting@interactivetools.com and we can go over some options.

Thanks!

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/