Documentation
Configuration / autoformat.rules
This option enables you to auto resize or convert images when they get uploaded. For example you when you upload a image you can generate 3 fixed sizes of the images all resizing will be proportional.
The parameter is in the following format:{width}x{height}|{format}={filename},..
Both the resize part and format path is optional. So you can for example only change the image format with this pattern: gif=%f.gif or only resize it by this pattern: 320x240=%f_320x240.%e
Here is a more complex pattern: 320x240|gif=gifs/%f_%w_%h.gif,320x240=%f_%w_%h.%e
It will generate a 320x240 large gif in the gifs directory it will auto create the directory. It will also make a 320x240 image in the same directory as the uploaded file.
Available formats are: gif,jpg,png
Filename parameters
Name | Summary |
---|---|
%f | Filename without extension for example "myimage". |
%e | Extension the extension part of the image for example "gif". |
%w | Output image width, the proportional value. |
%h | Output image height, the proportional valie. |
%tw | Target width/specified width by the resize option. |
%th | Target height/specified height by the resize option. |
%ow | Original width, before the image gets resized. |
%oh | Original height, before the image gets resize. |
Example
$moxieManagerConfig['autoformat.rules'] = '320x240|gif=%f_%w_%h.gif,320x240=%f_%w_%h.%e';
<add key="autoformat.rules" value="320x240|gif=%f_%w_%h.gif,320x240=%f_%w_%h.%e
" />