566 tutoriels disponibles
Chercher un tutoriel
Bienvenue
sur Shareannonce
 
Ajouter cadre autour d'une image en php
Ecrit par: Shareannonce
Date création:  19-04-2011
Nombre de vues:  3464
Catégorie:  informatique > developpement > php
Note: 
 
   Tutoriel N° 9c

Afficher une image avec un cadre autour en PHP dynamiquement





Voici le script PHP qui appelle une fonction avec votre image en paramètre:

cadre.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

<?
// ajoute un filet autour d'une image
function cadre($image)
{

$size = GetImageSize($image);
$src_w = $size[0];
$src_h = $size[1];

$src_w5=$src_w+5;
$src_h5=$src_h+5;

$src_w10=$src_w+10;
$src_h10=$src_h+10;

$box="<div id="casea1b1" style="position:relative;left:100;top:100;width:$src_w10px;height:$src_h10px;">

<div id="c1" style="position:absolute;left:0;top:0;width:5px;height:5px;"><img src="a0.jpg" width="5" height="5"></div>
<div id="c2" style="position:absolute;left:5;top:0;width: $src_w px;height:5px;"><img src="a1.jpg" width="$src_w" height="5"></div>
<div id="c3" style="position:absolute;left:$src_w5;top:0;width:5px;height:5px;"><img src="a2.jpg" width="5" height="5"></div>

<div id="c4" style="position:absolute;left:0;top:5;background-image:url(mgauche.jpg);"><img src="vide.gif" width="5" height="$src_h"></div>
<div id="c5" style="position:absolute;left:5;top:5"><img src="$image" width="$src_w" height="$src_h"></div>
<div id="c6" style="position:absolute;left:$src_w5;top:5;background-image:url(mdroite.jpg)"><img src="vide.gif" width="5" height="$src_h"></div>

<div id="c7" style="position:absolute;left:0;top:$src_h5;width:5px;height:5px;"><img src="b0.jpg" width="5" height="5"></div>
<div id="c8" style="position:absolute;left:5;top:$src_h5;width: $src_w px;height:5px;"><img src="b1.jpg" width="$src_w" height="5"></div>
<div id="c9" style="position:absolute;left:$src_w5;top:$src_h5;width:5px;height:5px;"><img src="b2.jpg" width="5" height="5"></div>

</div>";

return $box;
;}

echo cadre("image.jpg");?>
</body>
</html>





Télécharger les sources de ce tutoriel

 
 
   Autres tutoriels de la même catégorie >
 
ShareAnnonce version 2.0 Tous droits reserves. | Condition d'utilisation | Contact