<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Examples</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="gmagick.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.gmagick.html">Gmagick</a></div> <div class="up"><a href="book.gmagick.html">Gmagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="gmagick.examples" class="chapter"> <h1>Examples</h1> <p class="para"> The following shows some common Gmagick image operations. </p> <div class="example" id="example-3298"> <p><strong>Example #1 Gmagick Example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">//Instantiate a new Gmagick object<br /></span><span style="color: #0000BB">$image </span><span style="color: #007700">= new </span><span style="color: #0000BB">Gmagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'example.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//Make thumbnail from image loaded. 0 for either axes preserves aspect ratio<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-></span><span style="color: #0000BB">thumbnailImage</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//Create a border around the image, then simulate how the image will look like as an oil painting<br />//Notice the chaining of mutator methods which is supported in gmagick<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-></span><span style="color: #0000BB">borderImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"yellow"</span><span style="color: #007700">, </span><span style="color: #0000BB">8</span><span style="color: #007700">, </span><span style="color: #0000BB">8</span><span style="color: #007700">)-></span><span style="color: #0000BB">oilPaintImage</span><span style="color: #007700">(</span><span style="color: #0000BB">0.3</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//Write the current image at the current state to a file<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-></span><span style="color: #0000BB">write</span><span style="color: #007700">(</span><span style="color: #DD0000">'example_thumbnail.jpg'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="gmagick.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.gmagick.html">Gmagick</a></div> <div class="up"><a href="book.gmagick.html">Gmagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>