andy's php projects
Script and site usage:
All of the scripts on this site are provided free for non-commercial, personal or non-profit use. If you wish to use any of these in a commercial system, please refer to the payment plan.

Support:
Support for each of the scripts is given, free of charge, on the message board. Each script has its own message board which can be accessed by clicking on the 'project forum' link (beneath the description of each project).


Proudly hosted with Dreamhost

Save $20 when signing up for Dreamhost by using the promo code amnuts20


If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh to encourage me to continue? Every little helps!

Zend Certified Engineer logo


Drop Shadowed Thumbnail Creator

This class allows you to very easily create thumbnails of images, on which you can also apply a drop-shadow effect. You can control the colour of the background so that drop-shadow will fit better onto your page and the size of the thumbnail.

You can resize in an absolute or relative way (to a certain size or by a certain size), both as a pixel number or a percentage.

class.dropshadow.php

The main class file. Version two works considerably differently to version one. To emulate version one, see the 'class.originaldropshadow.php' file below.

17.84kb in size
last modified May 6, 2006 at 9:54pm
14773 views, 12746 downloads

class.originaldropshadow.php

This is an extension of the main class file to emulate version 1.x of the script.

3.6kb in size
last modified May 6, 2006 at 9:54pm
5824 views, 7607 downloads

ds_blcorner.png

230b in size
last modified May 6, 2006 at 9:54pm
8776 views, 8948 downloads

ds_bottom.png

419b in size
last modified May 6, 2006 at 9:54pm
6727 views, 8332 downloads

ds_brcorner.png

288b in size
last modified May 6, 2006 at 9:54pm
5477 views, 8419 downloads

ds_left.png

730b in size
last modified May 6, 2006 at 9:54pm
5139 views, 8194 downloads

ds_right.png

864b in size
last modified May 6, 2006 at 9:54pm
5004 views, 8171 downloads

ds_tlcorner.png

163b in size
last modified May 6, 2006 at 9:54pm
4936 views, 8113 downloads

ds_top.png

224b in size
last modified May 6, 2006 at 9:55pm
4809 views, 8193 downloads

ds_trcorner.png

203b in size
last modified May 6, 2006 at 9:55pm
5282 views, 8070 downloads

test.dropshadow.php

231b in size
last modified May 6, 2006 at 9:55pm
8345 views, 8616 downloads

test.originaldropshadow.php

<?php

// just to make the page background the same
function rgb2hex($rgb="")
{
    if (
$rgb == "") return "#FFFFFF";
    
$hex split(",",$_POST['colour']);
    return 
"#" 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;
        }
    }
}

?>

<html>
<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"?>
</select></p>
<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>
</form>

<hr noshade>

<?php

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

    
// the actual example

    
require "class.dropshadow.php";
    require 
"class.originaldropshadow.php";

    
$ds = new originalDropShadow();
    
$ds->setDebugging(TRUE);
    
$ds->setImageSize($_POST['size']);
    
$ds->setImageType("jpg");
    
$ds->setShadowPath("./shadows/");
    
$ds->createDropShadow("images/{$_POST['input']}""output.jpg"$colours);

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

?>

</body>
</html>
1.45kb in size
last modified May 6, 2006 at 9:55pm
6408 views, 7636 downloads
list all projects :: this project's forum :: script in action
added Sep 20, 2002 at 5:44pm :: updated May 22, 2003 at 5:19am :: 12 files :: 62518 views

© Andrew Collington, 2002-2007.