Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

To do:

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Image Component Proposal

Proposed Component Name Zend_Image
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Image
Proposers Dolf Schimmel
Marcin Lulek
Zend Liaison TBD
Revision 1.0 - 1 Oct 2008: Initial Draft.
1.1 - 16 Oct 2008: Finished proposal
1.1 - 10 Jan 2009: Ready for community review (wiki revision: 9)

Table of Contents

1. Overview

Zend_image is a component used for handling images.

Marcin Lulek a.k.a. Ergo2 has written an image component on which this proposal and initial codebase is based. His component does however miss an object oriented interface, and therefore it has been decided to fully refactor it. As for there is already a suitable codebase (preview of its functionality can be found here ; http://webreactor.eu/image/ ), offers of components written by others are unnecessary (appreciated though).

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will be able to resize images.
  • This component will be able to rotate images.
  • This component will be able to print a watermarks on images.
  • This component will be able to draw; eclipses, arcs, lines and polygons
  • This component will be able to convert images (I.E. from jpeg to bmp).
  • This component will be able to apply several filters, as well as adjust contrast etc.

4. Dependencies on Other Framework Components

  • GD or Imagemagick
  • Zend_Exception

5. Theory of Operation

An instance of Zend_Image will have one image resource by default. The path of this image can be specified when constructing it. It can however also be loaded from a file or string, or be created by Zend_Image itself. Once a resource has been loaded, the actions on the image can be performed, like cropping, resizing, rotating, etc.

By default Zend_Image will support two adapters, namely Zend_Image_Adapter_Gd and Zend_Image_Adapter_Imagemagick.

6. Milestones / Tasks

  • Milestone 1: Proposal finished
  • Milestone 2: Development of prototype started
  • Milestone 3: Proposal approved
  • Milestone 4: Working prototype checked into the incubator.
  • Milestone 5: Unit tests exist, work, and are checked into SVN.
  • Milestone 6: Documentation exists.

7. Class Index

  • Zend_Image
  • Zend_Image_Adapter_Abstract
  • Zend_Image_Adapter_Gd
  • Zend_Image_Adapter_Imagemagick
  • Zend_Image_Object_Line
  • Zend_Image_Object_Ellipse
  • Zend_Image_Object_Circle
  • Zend_Image_Object_Arch
  • Zend_Image_Object_Text
  • Zend_Image_Object_Polygon
  • Zend_Image_Object_Filter
  • Zend_Image_Action_AdjustAlpha
  • Zend_Image_Action_Resize
  • Zend_Image_Action_Blend
  • Zend_Image_Action_Rotate
  • Zend_Image_Action_Brightness
  • Zend_Image_Action_Contrast
  • Zend_Image_Action_Colorize
  • Zend_Image_ObjectInterface_Line
  • Zend_Image_ObjectInterface_Ellipse
  • Zend_Image_ObjectInterface_Circle
  • Zend_Image_ObjectInterface_Arch
  • Zend_Image_ObjectInterface_Text
  • Zend_Image_ObjectInterface_Polygon
  • Zend_Image_ObjectInterface_Filter
  • Zend_Image_ActionInterface_AdjustAlpha
  • Zend_Image_ActionInterface_Resize
  • Zend_Image_ActionInterface_Blend
  • Zend_Image_ActionInterface_Rotate
  • Zend_Image_ActionInterface_Brightness
  • Zend_Image_ActionInterface_Contrast
  • Zend_Image_ActionInterface_Colorize
  • Zend_Image_Adapter_Gd_Object_Line
  • Zend_Image_Adapter_Gd_Object_Ellipse
  • Zend_Image_Adapter_Gd_Object_Circle
  • Zend_Image_Adapter_Gd_Object_Arch
  • Zend_Image_Adapter_Gd_Object_Text
  • Zend_Image_Adapter_Gd_Object_Polygon
  • Zend_Image_Adapter_Gd_Object_Filter
  • Zend_Image_Adapter_Imagemagick_Object_Line
  • Zend_Image_Adapter_Imagemagick_Object_Ellipse
  • Zend_Image_Adapter_Imagemagick_Object_Circle
  • Zend_Image_Adapter_Imagemagick_Object_Arch
  • Zend_Image_Adapter_Imagemagick_Object_Text
  • Zend_Image_Adapter_Imagemagick_Object_Polygon
  • Zend_Image_Adapter_Imagemagick_Object_Filter
  • Zend_Image_Adapter_Gd_Action_AdjustAlpha
  • Zend_Image_Adapter_Gd_Action_Resize
  • Zend_Image_Adapter_Gd_Action_Blend
  • Zend_Image_Adapter_Gd_Action_Rotate
  • Zend_Image_Adapter_Gd_Action_Brightness
  • Zend_Image_Adapter_Gd_Action_ActionInterface_Contrast
  • Zend_Image_Adapter_Gd_Action_Colorize
  • Zend_Image_Adapter_Imagemagick_Action_AdjustAlpha
  • Zend_Image_Adapter_Imagemagick_Action_Resize
  • Zend_Image_Adapter_Imagemagick_Action_Blend
  • Zend_Image_Adapter_Imagemagick_Action_Rotate
  • Zend_Image_Adapter_Imagemagick_Action_Brightness
  • Zend_Image_Adapter_Imagemagick_Action_Contrast
  • Zend_Image_Adapter_Imagemagick_Action_Colorize

8. Use Cases

UC-01

$options = array('thickness' => 5,
'filled' => true,
'startX' => 10,
'startY' => 15,
'endX' => 50,
'endY' => 125);
$image = new Zend_Image('/path/to/image.png');
$image->draw(Zend_Image::LINE,$options);
$image->save();

UC-02

$line = new Zend_Image_Line();
$line->from(10,15)
->to(50,125)
->setFilled(true);
$image = new Zend_Image('/path/to/image.png'); // Autodetect adapter to use
$image->draw($line);
$image->save();

UC-03

$chain = new Zend_Image_Chain();
$line = new Zend_Image_Object_Line();
$line(10,15,50,125)->setFilled(true);
$chain->add($line);
$image = new Zend_Image('/path/to/image.png',Zend_Image::GD);
$image->perform($chain);
$image->save();

UC-04

// Create new image;
$image = new Zend_Image();
$image->create(50,20); // X, Y size;

file_put_contents('/path/to/image.png',$image->get()); //
$image->save('/path/to/image.png'); // Both lines do the same

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.