⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imagick.examples.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Examples</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.imagick.html">The Imagick class</a></div> <div class="up"><a href="book.imagick.html">ImageMagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <div id="imagick.examples-1" class="section">  <h2 class="title">Examples</h2>  <p class="para">   Imagick makes image manipulation in PHP extremely easy through an OO   interface. Here is a quick example on how to make a thumbnail:   <div class="example">    <p><b>Example #1 Creating a thumbnail in Imagick</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/jpeg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'image.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;0&nbsp;is&nbsp;provided&nbsp;as&nbsp;a&nbsp;width&nbsp;or&nbsp;height&nbsp;parameter,<br />//&nbsp;aspect&nbsp;ratio&nbsp;is&nbsp;maintained<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">thumbnailImage</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p>  <p class="para">   Using SPL and other OO features supported in Imagick, it can be simple   to resize all files in a directory (useful for batch resizing large   digital camera images to be web viewable). Here we use resize, as we might   want to retain certain meta-data:   <div class="example">    <p><b>Example #2 Make a thumbnail of all JPG files in a directory</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$images&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #0000BB">glob</span><span style="color: #007700">(</span><span style="color: #DD0000">'images/*.JPG'</span><span style="color: #007700">));<br /><br />foreach(</span><span style="color: #0000BB">$images&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Providing&nbsp;0&nbsp;forces&nbsp;thumbnailImage&nbsp;to&nbsp;maintain&nbsp;aspect&nbsp;ratio<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">thumbnailImage</span><span style="color: #007700">(</span><span style="color: #0000BB">1024</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br />}<br /><br /></span><span style="color: #0000BB">$images</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeImages</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span></span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -