<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/image.examples.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'image.examples-watermark.php',
    1 => 'Ajout d\'un tatouage num&eacute;rique sur des images en utilisant un canal Alpha',
    2 => 'Ajout d\'un tatouage num&eacute;rique sur des images en utilisant un canal Alpha',
  ),
  'up' => 
  array (
    0 => 'image.examples.php',
    1 => 'Exemples',
  ),
  'prev' => 
  array (
    0 => 'image.examples-png.php',
    1 => 'Cr&eacute;ation d\'une image PNG avec PHP',
  ),
  'next' => 
  array (
    0 => 'image.examples.merged-watermark.php',
    1 => 'Exemple avec imagecopymerge pour cr&eacute;er un
  tatouage num&eacute;rique translucide',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/image/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="image.examples-watermark" class="section">
  <h2 class="title">Ajout d&#039;un tatouage numérique sur des images en utilisant un canal Alpha</h2>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Ajout d&#039;un tatouage numérique sur des images en utilisant un canal Alpha</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Charge le cachet et la photo afin d'y appliquer le tatouage numérique<br /></span><span style="color: #0000BB">$stamp </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">'stamp.png'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #DD0000">'photo.jpeg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Définit les marges pour le cachet et récupère la hauteur et la largeur de celui-ci<br /></span><span style="color: #0000BB">$marge_right </span><span style="color: #007700">= </span><span style="color: #0000BB">10</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$marge_bottom </span><span style="color: #007700">= </span><span style="color: #0000BB">10</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sx </span><span style="color: #007700">= </span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$stamp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$sy </span><span style="color: #007700">= </span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">$stamp</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Copie le cachet sur la photo en utilisant les marges et la largeur de la<br />// photo originale afin de calculer la position du cachet <br /></span><span style="color: #0000BB">imagecopy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">$stamp</span><span style="color: #007700">, </span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">) - </span><span style="color: #0000BB">$sx </span><span style="color: #007700">- </span><span style="color: #0000BB">$marge_right</span><span style="color: #007700">, </span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">) - </span><span style="color: #0000BB">$sy </span><span style="color: #007700">- </span><span style="color: #0000BB">$marge_bottom</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$stamp</span><span style="color: #007700">), </span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">$stamp</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">// Affichage<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type: image/png'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagepng</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="mediaobject">
     
     <div class="imageobject">
      <img src="images/21009b70229598c6a80eef8b45bf282b-watermarks.png" alt="Ajout d'un tatouage numérique à l'image en utilisant un canal alpha" width="320" height="240" />
     </div>
    </div>
   </div>
   Cet exemple montre un moyen simple d&#039;appliquer un tatouage numérique
   et un cachet aux photos et les images sous licence.
   Il est à noter la présence d&#039;un canal Alpha dans le cachet ainsi que du texte
   anti-aliasé. Ces 2 éléments seront préservés lors de la copie.
  </p>
 </div><?php manual_footer($setup); ?>