[SOLVED] image fns worked and now all of a sudden doesn't in

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

image fns worked and now all of a sudden doesn't in IIS6

Post by anjanesh »

Hello
I was using image functions and I got it to work by setting the extension_dir = "c:\PHP\extensions\" and extension=php_gd2.dll.
Everything worked ok and then I wanted to use imagerotate() but was not rotating. So I turned display_errors = On to find out the mistake and restarted IIS6. Now no image functions are working !!! Thats impossible because all I did was change display_errors = On. The image just does not load - and theres no warning or error. How is this so complicated ?
I also turned display_startup_errors = On but I'm sure this makes no difference.
Please help.
Thanks
Anjanesh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

check your error logs.. with some errors, display errors won't work because of some other problem before it could print anything...
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

How do I find out the filename where these logs are created ?
I uncommented error_log and changed to
error_log = D:\Anjanesh\htdocs\ErrorLogs.txt
I ran the script again but there is no such file
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I have this in test.php
<IMG SRC="images.php?text=hello" BORDER=0>
But there was no output so I ran images.php and I get these errors : This is really strange because it worked the first time I ran these scripts. All I did was change display_errors=On
These are the first 2 lines in images.php

Code: Select all

define(MAX_WIDTH,100);
   define(MAX_HEIGHT,100);
Now I am getting this (unformatted html)

<br />
<b>Notice</b>: Use of undefined constant MAX_WIDTH - assumed 'MAX_WIDTH' in <b>D:\Anjanesh\htdocs\test\images.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Use of undefined constant MAX_HEIGHT - assumed 'MAX_HEIGHT' in <b>D:\Anjanesh\htdocs\test\images.php</b> on line <b>3</b><br />
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
with a lot of other junk (probably the image).
I checked the source (view-source) and this is exactly what came up. Now even if the image didn't show how can the html tags not ? My other non-images scripts are working fine
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you haven't defined MAX_WIDTH and MAX_HEIGHT... either you are using those in an array access, or they are supposed to be constants and you need to [php_man]define[/php_man]() them.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Thats impoosible because after <?php I have

Code: Select all

define(MAX_WIDTH,100);
define(MAX_HEIGHT,100);
And the only time I have used them is
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
both $width & $height are having values.

And this EXACT script worked before without probs from definition
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

define('MAX_WIDTH',100);
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Strange. Now I do this & it works.

define("MAX_WIDTH",100);
define("MAX_HEIGHT",100);

But I am positive that the code that I had before did not have the quotes. Why / How is this ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

with display_errors on, all errors reported by the core will show.. those notices were there before, however they were being written to the error logs (or not written, depending on your default error_reporting level)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Thanks. SOLVED.
In my php.ini error_reporting = E_ALL
Either way I got the result done some other way. I'll have to keep in mind these changes
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You should always have display errors on...

It will cause you much less pain in the long run when developping scripts by knotting out every little error.
Post Reply