basic image manipulation php

Post on 03-Dec-2014

1.585 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Learn the basics of creating, converting, and acquiring information on images.

TRANSCRIPT

Basic Image Creation and Manipulation

OverviewObjective

Learn the basics of creating, converting, and acquiring information on images.

Requirements

Installed version of Imagick

Estimated Time

10 minutes

www.prodigyview.com

Follow Along With A Code Example

1. Download a copy of the example code at www.prodigyview.com/source.

2.Install the system in an environment you feel comfortable testing in.

3.Proceed to examples/avi/ImageBasics.php

http://www.prodigyview.com

Drawing A RectangleThe most basic image we can draw is a rectangle. The rectangle

1. Set the image width, height, and color.

2.Returns the full path location of the image

3. Remove part of the image path 4. Display the image

RectangleThe rectangle that will be drawn should like these two.

1, The location the image was saved

2. The image displayed

EllipseA more complex shape we can drawn is an ellipse, which is a circular shape.

1. Ellipse Width 2. Ellipse Height 3. Ellipse Color

4. The location the ellipse was saved

EllipseThe ellipses that were drawn from the previous code should look like this

Width and HeightCommon attributes of an image is the size and the width.

1. The location of the image on file file system

2. Get the image width 3. Get the image height

www.prodigyview.com

Convert Image FormatThe last thing we are going to do is convert an image’s format. Converting the formats will try to keep the image close to the quality of the original.

1. The location of the current image 2. The format to convert it to

3. The location of the file converted file

Convert Images

The converted PNG The converted GIF

www.prodigyview.com

Review

1. Create a rectangular image with PVImage::drawImage() method

2. Draw an ellipse with PVImage::drawEllipse()

3. Get the height of an image with PVImage::getImageHeight()

4. Get the width of an image with PVImage::getImageWidth()

5. Convert image formats with PVImage::convertImageFormat()

www.prodigyview.com

API ReferenceFor a better understanding of the image manipulation, check out the api at the two links below.

PVImage

www.prodigyview.com

More Tutorials

For more tutorials, please visit:

http://www.prodigyview.com/tutorials

top related