PHP Classes

File: test.originaldropshadow.php

Recommend this page to a friend!
  Classes of Andrew Collington  >  class.dropshadow.php  >  test.originaldropshadow.php  >  Download  
File: test.originaldropshadow.php
Role: Example script
Content type: text/plain
Description: Example of how to use the extension class.
Class: class.dropshadow.php
Create images/thumbnails with a drop-shadow effect
Author: By
Last change:
Date: 19 years ago
Size: 1,544 bytes


Class file image Download

// just to make the page background the same
function rgb2hex($rgb="")
    if (
$rgb == "") return "#FFFFFF";
$hex = split(",",$_POST['colour']);
"#" . dechex($hex[0]) . dechex($hex[1]) . dechex($hex[2]);

// get a file list
if (($handle=opendir("./images/")))
    while (
$node = readdir($handle))
$nodebase = basename($node);
        if (
$nodebase!="." && $nodebase!="..")
$files[] = $node;


<body bgcolor="<?=rgb2hex($_POST['colour'])?>">

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="display" value="1">
<p>input file name<br><select name="input">
<?php for($i=0; $i<count($files); $i++) echo "<option value=\"{$files[$i]}\">{$files[$i]}</option>\n"; ?>
<p>image size (0 for no resize)<br><input type="text" name="size" value="0"></p>
<p>colour (RRR,GGG,BBB)<br><input type="text" name="colour" value="255,255,255"></p>
<p><input type="submit" value="process"></p>

<hr noshade>


if ($_POST['display'])
$colours = split(",",$_POST['colour']);

// the actual example

require "class.dropshadow.php";

$ds = new originalDropShadow();
$ds->createDropShadow("images/{$_POST['input']}", "output.jpg", $colours);

"<p><img src=\"output.jpg\" alt=\"finished result\"></p>\n";



For more information send a message to info at phpclasses dot org.