Outils pour utilisateurs

Outils du site


php:vizhash_gd_source

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
php:vizhash_gd_source [2011/05/31 13:49] sebsauvagephp:vizhash_gd_source [2014/07/12 11:26] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
-VizHash GS source code+VizHash GD source code
 <file php vizhash_gd.php> <file php vizhash_gd.php>
 <?php <?php
-// VizHash_GD 0.0.beta+// VizHash_GD 0.0.beta
 // Visual Hash implementation in php4+GD // Visual Hash implementation in php4+GD
 // See: http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd // See: http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd
 // This is free software under the zlib/libpng licence // This is free software under the zlib/libpng licence
 // http://www.opensource.org/licenses/zlib-license.php // http://www.opensource.org/licenses/zlib-license.php
-$VERSION = "0.0.beta";+$VERSION = '0.0.beta';
 error_reporting(0); error_reporting(0);
-header("Cache-Control: max-age=2592000, public");+
 if (!isset($_GET['t'])) // Nothing to hash provided: We display the form if (!isset($_GET['t'])) // Nothing to hash provided: We display the form
  
-    header("Content-type: text/html"); +    header('Content-type: text/html'); 
     echo '<div style="font-family:Verdana,sans-serif; font-size:10pt;">VizHash_GD '.$VERSION.' - Visual Hash implementation in php4+GD.<br>';     echo '<div style="font-family:Verdana,sans-serif; font-size:10pt;">VizHash_GD '.$VERSION.' - Visual Hash implementation in php4+GD.<br>';
     echo 'See <a href="http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd">homepage</a> for more details.';     echo 'See <a href="http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd">homepage</a> for more details.';
Ligne 19: Ligne 19:
     echo '<input id="ok" type="submit" value="Hash" /></form>';     echo '<input id="ok" type="submit" value="Hash" /></form>';
     echo '<br>VizHash_GD accepts the following parameters:<br>';     echo '<br>VizHash_GD accepts the following parameters:<br>';
-    echo '<blockquote><b>t</b> : string to hash<br><b>width</b>: width of image (in pixels) (default:32, max:256)<br><b>height</b>: height of image (in pixels) (default:32, max:256)</blockquote><br>'; +    echo '<blockquote><b>t</b> : string to hash<br><b>width</b>: width of image (in pixels) (default:80, max:256)<br><b>height</b>: height of image (in pixels) (default:80, max:256)</blockquote><br>'; 
-    echo 'Examples: "hello"'; +    echo 'Examples: "hi"'; 
-    $example_url=$_SERVER['PHP_SELF'].'?t=hello';+    $example_url=$_SERVER['PHP_SELF'].'?t=hi';
     echo '<br>12x12:<br><img src="'.$example_url.'&width=12&height=12">';     echo '<br>12x12:<br><img src="'.$example_url.'&width=12&height=12">';
     echo '<br>16x16:<br><img src="'.$example_url.'&width=16&height=16">';     echo '<br>16x16:<br><img src="'.$example_url.'&width=16&height=16">';
Ligne 33: Ligne 33:
 $text = $_GET['t']; $text = $_GET['t'];
  
-// Size of vizshash in pixels (default:32x32)+// Size of vizshash in pixels (default:80x80)
 $width=80; if (isset($_GET['width'])) { $width=$_GET['width']; } $width=80; if (isset($_GET['width'])) { $width=$_GET['width']; }
 $height=80; if (isset($_GET['height'])) { $height=$_GET['height']; } $height=80; if (isset($_GET['height'])) { $height=$_GET['height']; }
Ligne 122: Ligne 122:
         case 6:         case 6:
             $start=getInt()*360/256; $end=$start+getInt()*180/256;             $start=getInt()*360/256; $end=$start+getInt()*180/256;
-            $points = array(getX(), getY(), getX(), getY(), getX(), getY(),getX(), getY()); 
             ImageFilledArc ($image, getX(), getY(), getX(), getY(),$start,$end,$color,IMG_ARC_PIE);             ImageFilledArc ($image, getX(), getY(), getX(), getY(),$start,$end,$color,IMG_ARC_PIE);
             break;                  break;     
Ligne 141: Ligne 140:
 drawshape($image,getInt(),$color); drawshape($image,getInt(),$color);
  
-header("Content-type: image/png");+// Image expires in 7 days (to lighten the load on the server) 
 +// and allow image to be cached by proxies. 
 +$duration=7*24*60*60; 
 +header ('Expires: ' . gmdate ('D, d M Y H:i:s', time() + $duration) . ' GMT'); 
 +header('Cache-Control: max-age='.$duration.', public'); 
 + 
 +// Prevent some servers to add "Pragma:no-cache" by default 
 +header('Pragma:cache'); 
 + 
 +header('Content-type: image/png');
 imagepng($image); // Return the image in PNG format. imagepng($image); // Return the image in PNG format.
 echo ' -- vizhash_gd '.$VERSION.' by sebsauvage.net'; echo ' -- vizhash_gd '.$VERSION.' by sebsauvage.net';
php/vizhash_gd_source.1306849770.txt.gz · Dernière modification : 2014/07/12 11:26 (modification externe)