Image width and height by default (tl_news.php)
Code:
'size' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['size'],
'exclude' => true,
'inputType' => 'imageSize',
'options' => array('crop', 'proportional', 'box'),
'reference' => &$GLOBALS['TL_LANG']['MSC'],
'eval' => array('rgxp'=>'digit', 'nospace'=>true, 'tl_class'=>'w50')
),
how make Image width and height by default = 100x100 crop ?
'dafault' => array('width'=>100,'height'=>100,'options'=>'crop' ),
this not work
Re: Image width and height by default (tl_news.php)
Try serializing it:
Code:
'default' => serialize(array('100', '100', 'crop'));
For later versions of Contao, the cropping options changed, so it would be something like this:
Code:
'default' => serialize(array('100', '100', 'center_center'));
Just keep in mind that if it does work, it will only work for new records and not when you edit an existing one (even if you didn't choose to add an image or left the width/height fields blank).
For the "100x100 crop" -- is that just a default that a user can override, or do you want to force those values?
If you want to force them, another way to go about it is to hide the 'size' field completely in permissions, and then generate a 100x100 cropped image in your news template with an insert tag:
Code:
{{image::<?php echo $this->src?width=100&height=100&mode=crop&alt=<?php echo $this->alt; ?>}}
Re: Image width and height by default (tl_news.php)
Medianomaly, thanks.
this works
Code:
'default' => array('100', '100', 'crop'),
serialize not need
Re: Image width and height by default (tl_news.php)
Nice!
Good to know (that serialize isn't needed), thanks.