Restrict Image Sizes in Layouts
In MY_fuel_layouts.php I have the following for my main layout:
$config['layouts']['main'] = array(
'fields' => array(
'Header' => array('type' => 'fieldset', 'label' => 'Header', 'class' => 'tab'),
'page_title' => array('label' => lang('layout_field_page_title')),
'meta_description' => array('label' => lang('layout_field_meta_description')),
'meta_keywords' => array('label' => lang('layout_field_meta_keywords')),
'header_image' => array('label' => 'Header Image', 'type' => 'image'),
'Body' => array('type' => 'fieldset', 'label' => 'Body', 'class' => 'tab'),
'heading' => array('label' => lang('layout_field_heading')),
'body' => array('label' => lang('layout_field_body'), 'type' => 'textarea', 'description' => lang('layout_field_body_description')),
'body_class' => array('label' => lang('layout_field_body_class')),
)
);
There does not seem to be a way to restrict the image size of the image field.
Is this a missing feature or missing documentation?
Thanks.
Comments
http://docs.getfuelcms.com/general/forms#asset
this is my demo
http://thietkelogon.com/service/chin-lc-truyn-thng-trc-tuyn
image not show, my image path is {img_path(acs1.png)} but i can see that on ckeditor and preview mode.
... public $parsed_fields = array('content'); // fields in the database that should be parsed when outputted ...
I have looked at the documentation with regards to this area here:
http://docs.getfuelcms.com/general/forms#asset
However, the parameters "width" and "height" are used when create_thumb is TRUE to create the thumbnail, but not restrict the uploaded image size.
In this case, it appears that "width" and "height" are only for the thumbnail, see:
http://docs.getfuelcms.com/general/assets
Width: The thumbnails width (Image Specific)
Height: The thumbnails height (Image Specific)
This differs from the asset behaviour seen in the "forms" section previously mentioned...
The differences in the documentation also appear to be how it works.
For example, in form_fields(), if you set the width to 1024 and the height to 768, then upload a 200 by 200 image, the image will unexpectedly resize to 1024 by 768.
While, in layouts, it works as you would expect, where it simple returns an error when you're not using create thumb if the image is the wrong size.
"The image you are attempting to upload doesn't fit into the allowed dimensions".
However I now realise that this is a result of the assets_upload_max_width and assets_upload_max_height in MY_fuel.php.
It seems there is no way to restrict the width/height per image, only globally.