Once scaling is done use unlink to delete original file
--I have the plugin working and it's very great.
Only question I have is currently I am trying to upload an image and scale that image to a fixed width, and create a thumb.
That's all good.
But the original image also gets uploaded and untouched.
So I only need the 2 images created from the uploaded, but end up with 3.
Scale the uploaded image to a fixed with and create a thumb from that.
Code snip below creates the scaled 750px width, the 100x75 thumb and the untouched image.
Just not sure how to modify the uploaded image when looking at the documentation. Or delete it after upload since I do not need the original uploaded file.
http://milesj.me/code/cakephp/uploader
public $actsAs = array(
'Uploader.Attachment' => array(
'image' => array(
'name' => 'formatFilename',
'uploadDir' => 'img/uploads/',
//'dbColumn' => 'image',
'maxNameLength' => 30,
'overwrite' => true,
'stopSave' => true,
'allowEmpty' => false,
'transforms' => array(
'scale' =>array(
'method' => 'resize',
'width' => 750,
//'height' => 75,
'aspect' => true,
'mode' => 'width',
'self' => true,
'dbColumn' => 'image'),
'thumb' =>array(
'method' => 'crop',
'width' => 100,
'height' => 75,
'aspect' => true,
'mode' => 'width',
'self' => true,
'dbColumn' => 'thumb')
)
)
)
);
Any help would be great.
Thanks,
Dave
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment