Zend Framework: Zend_Image Component Proposal
| Proposed Component Name | Zend_Image |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Image |
| Proposers | Davey Shafik |
| Revision | 1.0 - 12 November 2006: Initial Version. (wiki revision: 4) |
Table of Contents
1. Overview
Zend_Image provides easier image manipulation using GD.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will provide an easy wrapper for common GD operations for Jpeg/Png/Gif images
4. Dependencies on Other Framework Components
- Zend_Exception
5. Theory of Operation
Uses a factory method to return an image specific class on which to perform modifications
6. Milestones / Tasks
- Milestone 1: Working prototype checked into the incubator
- Milestone 2: Unit Tests & Documentation
- Milestone 3: Release in trunk
7. Class Index
- Zend_Image
- Zend_Image_Png
- Zend_Image_Jpeg
- Zend_Image_Gif
- Zend_Image_Exception
8. Use Cases
9. Class Skeletons
| 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. |
I really think it should be considered.
Bill, you state "We're trying not to make ZF components that simply wrap existing PHP classes.", yet we have a Zend_Json component. Contradicting yourself there. I think this proposal has it's place and while GD and ImageMagick both are easy, with this component users could do simple tasks easier and using less code on their end.
There's no contradiction. The Zend_Json component provides native (that is, in PHP) JSON encoding and decoding, so there is no need to add a PECL extension. This vastly simplifies the installation of open-source projects that rely on this functionality but do not want to depend on a particular PHP installation having that extension. This is also the same principle behind my Zend_Mime_Magic proposal. Unless this component proposes to resize and crop images natively (which would be extremely slow), it is just a wrapper.
Now, that's not to say that it doesn't have some value. I am writing something very similar to this simply to abstract over GD and ImageMagick's very different APIs (which I do not agree are particularly easy to use). Some things overlap directly, while other things (namely, filters) are applied very differently. Any class that provides an abstraction layer over both would have a difficult time covering all functionality. That's why mine only focuses on the most common use cases.
I think Zend should have Zend_Image component, but not like example presented above, more like phpThumb() - with native support for gif/bmp without GD or ImageMagic, cross domain hot link protection, permissions, and more... I think this could be very usefull! I use phpThumb now, but i dont't like its coding style, and not modern architecture (but I havent seen anything better)...
Think about it!
ZF Home Page
Code Browser
Wiki Dashboard
We already had a Zend_Image proposal present. We reviewed that one last week, and decided that it did not show sufficient value over simply using GD or ImageMagick.
We're trying not to make ZF components that simply wrap existing PHP classes.
GD really isn't so hard to use that it requires a simpler interface.