<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.imageresolution.php',
    1 => 'imageresolution',
    2 => 'Recupera o define la resoluci&oacute;n de la imagen',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'Funciones de GD e Im&aacute;genes',
  ),
  'prev' => 
  array (
    0 => 'function.imagerectangle.php',
    1 => 'imagerectangle',
  ),
  'next' => 
  array (
    0 => 'function.imagerotate.php',
    1 => 'imagerotate',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/image/functions/imageresolution.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imageresolution" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imageresolution</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">imageresolution</span> &mdash; <span class="dc-title">Recupera o define la resolución de la imagen</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.imageresolution-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imageresolution</strong></span>(<span class="methodparam"><span class="type"><a href="class.gdimage.php" class="type GdImage">GdImage</a></span> <code class="parameter">$image</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$resolution_x</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$resolution_y</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imageresolution()</strong></span> permite definir y recuperar la resolución de una imagen
   en DPI (puntos por pulgada). Si los parámetros opcionales son <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>,
   la resolución actual se devuelve en un array indexado. Si únicamente
   <code class="parameter">resolution_x</code> no es <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, la resolución horizontal y vertical se
   establece a este valor. Si ninguno de los parámetros opcionales es <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, la resolución
   horizontal y vertical se establecen a estos valores respectivamente.
  </p>
  <p class="para">
   La resolución se utiliza únicamente como metadatos cuando las imágenes
   se leen y escriben en formatos que soportan este tipo de información (actualmente
   PNG y JPEG). Esto no afecta a las operaciones de dibujo. La resolución por
   defecto de las nuevas imágenes es de 96 DPI.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.imageresolution-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
<dt><code class="parameter">image</code></dt><dd><p class="para">
 Un objeto <span class="classname"><a href="class.gdimage.php" class="classname">GdImage</a></span>, retornado por una de las funciones de
 creación de imágenes, como <span class="function"><a href="function.imagecreatetruecolor.php" class="function">imagecreatetruecolor()</a></span>.
</p></dd>
   
    <dt><code class="parameter">resolution_x</code></dt>
    <dd>
     <p class="para">
      La resolución horizontal en DPI/PPP.
     </p>
    </dd>
   
   
    <dt><code class="parameter">resolution_y</code></dt>
    <dd>
     <p class="para">
      La resolución vertical en DPI/PPP.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.imageresolution-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Cuando se utiliza como recuperador,
   esto devuelve un array indexado con las resoluciones horizontal y
   vertical en caso de éxito.
   Cuando se utiliza como definidor, siempre devuelve <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imageresolution-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">resolution_x</code> y <code class="parameter">resolution_y</code> son ahora nullable.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.imageresolution-examples">
  <h3 class="title">Ejemplos</h3>
  <div class="example" id="imageresolution.example.basic">
   <p><strong>Ejemplo #1 Definir y recuperar la resolución de una imagen</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imageresolution</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">imageresolution</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">imageresolution</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">300</span><span style="color: #007700">, </span><span style="color: #0000BB">72</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">imageresolution</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>El ejemplo anterior mostrará:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [0] =&gt; 200
    [1] =&gt; 200
)
Array
(
    [0] =&gt; 300
    [1] =&gt; 72
)</pre>
</div>
   </div>
  </div>
 </div>


</div><?php manual_footer($setup); ?>