Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Finally, ask the thumbnail object to save the thumbnail. You must provide a
file path. Optionally, if you don't want the thumbnail to use the same mime
type as the source image, you can specify a mime type as the second parameter.

Both the source and destination file paths must be absolute paths in your
filesystem. To store files under a symfony project directory, make sure you use
the
[http://www.symfony-project.com/book/trunk/19-Mastering-Symfony-s-Configuration-Files#The%20Basic%20File%20Structure
directory constants], accessed by sfConfig::get().

Creating a thumbnail for an uploaded file

If you upload images, you might need to create thumbnails of each uploaded file. For instance, to save a thumbnail of maximum size 150x150px at the same time as the uploaded image, the form handling action can look like:

By default sfThumbnail resizes the image in order to get to the desired width
and height of the thumbnail. But what if you want to force the thumbnail to be
a certain width and height but without distorting the image of the source size
scale is different than the thumbnail size scale.

Now you can use a custom option "method" to achieve just that but "shaving" the
source image in order to get it to be the same scale as the thumbnail and them
resize it to the required dimentions.

When "shave_bottom" is used and the imageÃ¢â‚¬â„¢s width is greater than the
height then sfThumbnail shaves from both left side and right side until the
desired scale.

There is one requirement for the "method" option to work as expected and it is
to turn off scaling (set the third parameter of sfThumbnail to FALSE).