andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. 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? If you wish to use any of these in a commercial system, please refer to the payment plan.


newbie quession =)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
psyance
Newbie


Joined: 08 Mar 2004
Posts: 1

PostPosted: Mon Mar 08, 2004 10:00 pm    Post subject: newbie quession =) Reply with quote

Hello.

First, let me say that from what you've created, it looks great and am happy that you're providing something this cool for free to us =).

Now, I can't get it to work.

I'm a php n00b to say the least. I mainly work in ASP and am migrating to php.

Here's the errors that I'm getting:

Debug message from function resizeByPercent: Image size is 800 / 600


Notice: Undefined index: l in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 266

Notice: Undefined index: r in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 267

Notice: Undefined index: t in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 268

Notice: Undefined index: b in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 269

Notice: Undefined index: tl in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 270

Notice: Undefined index: tr in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 271

Notice: Undefined index: bl in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 272

Notice: Undefined index: br in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 273

Debug message from function applyShadow: The shadow files could not be loaded.

Debug message from function _showImage: There is no processed image to show.


Here's my default.php file that's loading the class:

<?php

require "dropshadow.php";

$ds = new dropShadow(TRUE);
$ds->setShadowPath('./dropshadow/');
$ds->loadImage('./1.jpg');
$ds->resizeByPercent(50, 0);
$ds->applyShadow('CCCCCC');
$ds->showShadow('png');

?>

all images and scripts are in the dropshadow dir.

Any suggestions?

Thanks again!

. psyance .
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Mar 09, 2004 3:55 am    Post subject: Re: newbie quession =) Reply with quote

Hi psyance, and welcome to the board!

psyance wrote:
I'm a php n00b to say the least. I mainly work in ASP and am migrating to php.


Then welcome to the wonderful world of PHP, too. Smile

psyance wrote:
Here's the errors that I'm getting:

Debug message from function resizeByPercent: Image size is 800 / 600

Notice: Undefined index: l in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 266

Notice: Undefined index: r in c:\domains\bodymod.org\wwwroot\temp\dropshadow\dropshadow.php on line 267

...


The 'debug' messages aren't errors, but are output from the script to help diagnose where problems might be. You can get rid of these very easily by passing 'false' (or no parameters) when creating an instance of the class.

The 'notice' messages aren't strictly errors, per say. There are a number of different levels of error messages in PHP. You have yours cranked up all the way so that it's displaying notices as well as errors. All that the notices are saying is that I'm trying to do something in an array which has the index 'r', but I haven't yet defined that index. PHP being as flexible as it is will create that index when I need it, so the script will still work, but because of your error level it's giving you a nice little reminder that, hey, perhaps you should be aware of this. Honestly, I should probably run my scripts with full error levels so this will not be a problem for the end user.

Anyway, to get rid of the 'notice' messages, you could tweak your php.ini file, or you could place this at the top of your script, within your PHP tags:

Code:
error_reporting (E_ALL ^ E_NOTICE);


psyance wrote:
Here's my default.php file that's loading the class:

<?php

require "dropshadow.php";

$ds = new dropShadow(TRUE);
$ds->setShadowPath('./dropshadow/');
$ds->loadImage('./1.jpg');
$ds->resizeByPercent(50, 0);
$ds->applyShadow('CCCCCC');
$ds->showShadow('png');

?>

all images and scripts are in the dropshadow dir.


Try making your script look like this:

Code:
<?php

    error_reporting (E_ALL ^ E_NOTICE);
    require_once "dropshadow.php";

    $ds = new dropShadow(false);
    $ds->setShadowPath('./dropshadow/');
    $ds->loadImage('./1.jpg');
    $ds->resizeByPercent(50, 0);
    $ds->applyShadow('CCCCCC');
    $ds->showShadow('png');

?>


and that should work for you. A little explaination of why it wasn't working before:

The 'showShadow' function outputs the image directly to the browser, and it does this by manipulating the HTTP header so that it has the correct content type (in the case above, image/png). Because you had debugging on, and because the notice message had been sent to the browser, the HTTP headers had already been set (to text/html), and could not be set again. By turning off debugging and supressing the notice messages you should be all set.

Something to be aware of; even white-space can cause HTTP headers to be set. So make sure you have no spaces or carriage returns at the end of the drop-shadow class.

Okay, that should all work out for you. If not, make sure that the 1.jpg is readable by the web server.

Let me know how it goes!

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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