Top Banner
Basic Image Creation and Manipulation
12

Basic Image Manipulation PHP

Dec 03, 2014

Download

Technology

ProdigyView

Learn the basics of creating, converting, and acquiring information on images.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Basic Image Manipulation PHP

Basic Image Creation and Manipulation

Page 2: Basic Image Manipulation PHP

OverviewObjective

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

Requirements

Installed version of Imagick

Estimated Time

10 minutes

www.prodigyview.com

Page 3: Basic Image Manipulation PHP

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

Page 4: Basic Image Manipulation PHP

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

Page 5: Basic Image Manipulation PHP

RectangleThe rectangle that will be drawn should like these two.

1, The location the image was saved

2. The image displayed

Page 6: Basic Image Manipulation PHP

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

Page 7: Basic Image Manipulation PHP

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

Page 8: Basic Image Manipulation PHP

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

Page 9: Basic Image Manipulation PHP

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

Page 10: Basic Image Manipulation PHP

Convert Images

The converted PNG The converted GIF

www.prodigyview.com

Page 11: Basic Image Manipulation PHP

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

Page 12: Basic Image Manipulation PHP

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