Zend Framework: Zend_Image Component Proposal
| Proposed Component Name | Zend_Image |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Image |
| Proposers | Eric Potvin |
| Revision | 0.1 - July 22, 2006: First Release. (wiki revision: 10) |
Table of Contents
1. Overview
Zend_Image, Zend_Image_Validation, Zend_Image_Utility and Zend_Image_Thumbnail are the classes to help you to manipulate image for any purpose.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- GD PHP library active.
4. Dependencies on Other Framework Components
- Zend_Exception
5. Theory of Operation
- Zend_Image must be instantiated.
- Zend_Image_Validation must be instantiated.
- Zend_Image_Utility does not need to me instantiated.
- Zend_Image_Thumbnail must be instantiated.
6. Milestones / Tasks
7. Class Index
- Zend_Image
- Zend_Image_Validation
- Zend_Image_Utility
- Zend_Image_Thumbnail
8. Use Cases
| UC-01 |
|---|
... (see good use cases book)
9. Class Skeletons
autoThumbnail
setPercentage - have not right idea.
If i want resize image by one edge, how i can do it?
It's needed when in template all images must have equals height (getted by percent from original size).
Same in "setSize"
usage, i know only result height, and width may be either
So, method must be like: setSize(integer $width=null, integer $height=null)
And another one question: Let me know how resizing image with crop or save original geometry?
PS: Don't kick me for my english
Erik,
your proposal looks good. I'd certainly use it.
About your Thumbnail class. It would be nice to have a method that resizes the image in one of three ways (either given as parameter, or as several methods):
- resize until either height or width fits within given boundary and crop the image (you'll make a center cutout, but image width and height are predictable)
- resize until both height and width fit within given boundaries (meaning that the exact size of the image is not predictable, but different for each image).
- lose original geometry and fit the image in the boundaries (thus messing up the original)
Additionally, as Eugene mentioned, it would be nice to be able to enter either one of height and width.
If you need any help with the implementation, let me know: <last name>@gmail.com
| Proposal not being considered This proposal has been reviewed. The proposal describes functionality that is very similar to the existing PHP interfaces for ImageMagick or GD. We are not considering this for inclusion in the Zend Framework at this time. However, working on image-manipulation for PHP is a great thing to do. We encourage you to get involved with the ImageMagick project: http://www.imagemagick.org/ |
ZF Home Page
Code Browser
Wiki Dashboard
I'm wondering if it might not be prudent to establish a common Zend_Image API and then to allow for multiple backends. In addition to GD, ImageMagick is another frequently used backend for which someone may at some point wish to implement a core module. The API detailed here looks very good in terms of being backend-independent and it should only take the addition of a method to specify which backend to use in order to implement what I'm describing. Perhaps an interface Zend_Image_API and a method Zend_Image::setBackend(Zend_Image_API). Thoughts?