Image Upload - Exact Dimensions
4 posts by 3 authors in: Forums > CMS Builder
Last Post: September 24, 2013 (RSS)
Hello,
I haven't seen a way, but is there a method to specify exact image dimensions for an upload field in CMSB? (without altering the core or creating a plugin, I'm looking for validation on an image upload field to be exactly X-width by X-height)
Many times we've been asked to integrate feature slideshows with controls in CMSB. We've done this for some clients that truly understand exact image dimensions are needed and have image editing experience (with a reminder note with dimensions in the field prefix or description). Otherwise, we won't integrate controls into CMSB for slideshows because history has shown us that the majority of our end users constantly ruin their feature slideshows and contact us for support (we end up taking controls out of their hands).
Thanks,
Steve
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:
- Exact dimensions (ie, 800 x 600) - this would be the most restrictive
- Minimum dimensions (ie, at least 800 wide and at least 600 tall)
- 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/