<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="imagick.resizeimage">
 <refnamediv>
  <refname>Imagick::resizeImage</refname>
  <refpurpose>Scales an image</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <modifier>public</modifier> <type>bool</type><methodname>Imagick::resizeImage</methodname>
   <methodparam><type>int</type><parameter>columns</parameter></methodparam>
   <methodparam><type>int</type><parameter>rows</parameter></methodparam>
   <methodparam><type>int</type><parameter>filter</parameter></methodparam>
   <methodparam><type>float</type><parameter>blur</parameter></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>bestfit</parameter><initializer>&false;</initializer></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>legacy</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Scales an image to the desired dimensions with a
   <link linkend="imagick.constants.filters">filter</link>.
  </para>
  &imagick.bestfit.note;
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>columns</parameter></term>
     <listitem>
      <para>
       Width of the image
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>rows</parameter></term>
     <listitem>
      <para>
       Height of the image
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>filter</parameter></term>
     <listitem>
      <para>
       Refer to the list of <link linkend="imagick.constants.filters">filter constants</link>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>blur</parameter></term>
     <listitem>
      <para>
       The blur factor where &gt; 1 is blurry, &lt; 1 is sharp.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>bestfit</parameter></term>
     <listitem>
      <para>
       Optional fit parameter.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &imagick.return.success;
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>PECL imagick 2.1.0</entry>
       <entry>
       Added optional fit parameter. This method now supports proportional scaling.
       Pass zero as either parameter for proportional scaling.  
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>



 <refsect1 role="examples">
  &reftitle.examples;
  <para>
    <example>
      <title> <function>Imagick::resizeImage</function></title>
      <programlisting role="php">
      <![CDATA[
<?php
function resizeImage($imagePath, $width, $height, $filterType, $blur, $bestFit, $cropZoom) {
    //The blur factor where > 1 is blurry, < 1 is sharp.
    $imagick = new \Imagick(realpath($imagePath));

    $imagick->resizeImage($width, $height, $filterType, $blur, $bestFit);

    $cropWidth = $imagick->getImageWidth();
    $cropHeight = $imagick->getImageHeight();

    if ($cropZoom) {
        $newWidth = $cropWidth / 2;
        $newHeight = $cropHeight / 2;

        $imagick->cropimage(
            $newWidth,
            $newHeight,
            ($cropWidth - $newWidth) / 2,
            ($cropHeight - $newHeight) / 2
        );

        $imagick->scaleimage(
            $imagick->getImageWidth() * 4,
            $imagick->getImageHeight() * 4
        );
    }


    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}

?>
]]>
      </programlisting>
    </example>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
