View previous topic :: View next topic |
Author |
Message |
surefire Newbie
Joined: 10 May 2004 Posts: 3
|
Posted: Mon May 10, 2004 11:57 am Post subject: I'm lost |
|
|
I'm not new to PHP by any means, but I must be making a really stupid mistake because I've gotten nowhere with this class for several hours.
I have GD2+
I have tried to make as few modifications as possible. Here is test.orginaldropshadow.php
Code: | <?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(FALSE);
$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> |
Getting these errors (when debugging turned on):
Quote: | Debug message from function applyShadow: There is no resized image, so the original image is being used.
Debug message from function applyShadow: The shadow files could not be loaded.
Debug message from function _saveImage: There is no processed image to save.
|
Thanks for your assistance. |
|
Back to top |
|
 |
amnuts Site Admin

Joined: 01 Sep 2002 Posts: 662 Location: East Sussex, England
|
Posted: Tue May 11, 2004 4:12 am Post subject: |
|
|
Hi Surefire, and welcome to the board!
Well, it seems like the class is working, but not producing the results you want. Where it seems to be falling down is that it doesn't resize the image (presumably you put '0' in for size, or does it always give that error?), and then it can't find the shadow images to load them. Because of that, nothing is done to the original image and so it doesn't save anything.
You have your shadow path as './shadow/'. If you haven't already, create that directory, download the shadow images from the project's homepage, and save them in to that folder (with the correct permissions so the web server/php can read them, naturally). Once you've done that, try the script again. Still giving you the same problems?
Also; are you new to the script, or did you have a version 1.x script previously used? If you are new, then I recommend just using the class.dropshadow.php file, and not bother with the class.originaldropshadow.php class. I only wrote that to give some backwards compatibility to users who were already using version 1.x (as 2.x changed rather radically).
Regards,
Andy |
|
Back to top |
|
 |
surefire Newbie
Joined: 10 May 2004 Posts: 3
|
Posted: Tue May 11, 2004 7:02 am Post subject: I am an idiot |
|
|
Okay... at least I admitted up front that it might be something really stupid.
I only grabbed seven of the eight png's (duh)
As soon as I uploaded the other one, it works. Out of curiousity (not complaining) is there a link to download all the files at once? I was wondering why each file was to be downloaded individually.
Last question, is there a readme document that I'm missing. I'm able to read the class and figure out what it does but wondered if there was a short cut.
Thanks for the great code. |
|
Back to top |
|
 |
amnuts Site Admin

Joined: 01 Sep 2002 Posts: 662 Location: East Sussex, England
|
Posted: Tue May 11, 2004 7:34 am Post subject: Re: I am an idiot |
|
|
surefire wrote: | Okay... at least I admitted up front that it might be something really stupid.
I only grabbed seven of the eight png's (duh) |
Ahh, well I'm glad it was an easy fix!
surefire wrote: | Out of curiousity (not complaining) is there a link to download all the files at once? I was wondering why each file was to be downloaded individually. |
There used to be... I had the files automaticcaly tar.gz up when requested (that way if a file changed I wouldn't need to update the compressed file myself). Unfortuantly it spawned a lot of zombie processes, so I had to remove that option. And since then I've just neglected to put a zip file up that I created manually. Soon, I hope!
surefire wrote: | Last question, is there a readme document that I'm missing. I'm able to read the class and figure out what it does but wondered if there was a short cut. |
Unfortunatly not, no. Other than looking at the comments in the code and the example file, there's not much other documentation around. If you need to know how to do something specific, just let me know!
surefire wrote: | Thanks for the great code. |
Thanks for liking it!
Andy |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|