Reputation: 611
I use the Upload plugin from https://github.com/josegonzalez/cakephp-upload
The problem is, while the main image is uploaded fine, it is not creating thumbnails.
Here is my model code
public $actsAs = array(
'Upload.Upload' => array(
'image' => array(
'thumbnailSizes' => array(
'featured' => '720x400',
'xsmall' => '98x98',
'small' => '152x110',
'medium' => '400x222',
'large' => '225x145',
'medium_home' => '232x128',
'xlarge' => '720x632',
'editorial' => '199x300',
'medium_editorial' => '180x249',
'small_editorial' => '152x211',
'xsmall_editorial' => '98x136'
),
'path' => '{ROOT}webroot{DS}uploads{DS}{model}{DS}{field}{DS}'
)
)
);
Any idea what should I change?
Upvotes: 0
Views: 715
Reputation: 298
Add 'thumbnails' => true
and also 'thumbnailMethod' => 'php'
in you array and the code will look like:
public $actsAs = array(
'Upload.Upload' => array(
'image' => array(
'thumbnails' => true,
'thumbnailMethod' => 'php',
'thumbnailSizes' => array(
'featured' => '720x400',
'xsmall' => '98x98',
'small' => '152x110',
'medium' => '400x222',
'large' => '225x145',
'medium_home' => '232x128',
'xlarge' => '720x632',
'editorial' => '199x300',
'medium_editorial' => '180x249',
'small_editorial' => '152x211',
'xsmall_editorial' => '98x136'
),
'path' => '{ROOT}webroot{DS}uploads{DS}{model}{DS}{field}{DS}'
)
)
);
I used the code below and it works fine for me:
public $actsAs = array(
'Upload.Upload' => array(
'photo' => array(
'fields' => array(
'dir' => 'photo_dir'
),
'deleteOnUpdate' => true,
'thumbnails' => true,
'thumbnailSizes' => array(
'64x64' => '64x64'
),
'thumbnailMethod' => 'php'
)
)
);
Upvotes: 1