getID3 constructor writes out to page header

The place for "I can't figure out how to..." questions.
Post Reply
ojredmond
User
Posts: 3
Joined: Thu Apr 19, 2007 11:40 am
Location: Hatfield, UK

getID3 constructor writes out to page header

Post by ojredmond » Thu Apr 19, 2007 11:55 am

Hi, I am trying to write a page that allows me to dynamically resize an image so that can store one copy of a photo and use it for both the thumb nail and picture. this script opens a file, resizes the image and sends it to the web browser. I am trying to make so that it can cope with differnet images types.

do to enable this i want the script to detect the image type for cleaverly than relying on file extension. so i decided to try and use getid3, this worked to detect the image type but the constructor cause the following error when i try and set the header to be an image.

Cannot modify header information

is there anything i can do to get ride of this problem?

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Thu Apr 19, 2007 5:45 pm

You are outputting something before your

Code: Select all

header("Content-type:  ....");
line.

This can be something as trivial as a space after ?> in on of the included files. PHP has a lazy solution called output buffering that you can turn on... (I do not recommended it though).

ojredmond
User
Posts: 3
Joined: Thu Apr 19, 2007 11:40 am
Location: Hatfield, UK

Post by ojredmond » Thu Apr 19, 2007 9:09 pm

Yes thats what i figured, but i have reduce the changes so that it works when i comment out the contstructor but fails when i leave the constructor in. is there an easy way of finding where in the getid3 constructor this is.

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Fri Apr 20, 2007 8:01 am

I am affraid I cannot help you as such. There should be no output at all from getID3(). One tip though: Install PHP5. It will tell you exactly where output was started (filename and linenumber).

ojredmond
User
Posts: 3
Joined: Thu Apr 19, 2007 11:40 am
Location: Hatfield, UK

Post by ojredmond » Fri Apr 20, 2007 12:03 pm

I am using PHP5 how do i figure out what line and file has first written output to the browser

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Fri Apr 20, 2007 3:16 pm

PHP5 usually says something like "Cannot modify header information .... output started in file, linenumber".

Might be an option you need to set in php.ini.

Post Reply