intersesting problem

Hi,

I'm using php 5 zend and oracle.


I get a picture into the page using:

<img src="dopic.php?image=REPLIC100450797">



in my dopic.php , which incidentally took several days to get working.
I have:


<?php
//DO NOT ADD ANYTHING TO THIS OR REMOVE IT OR ELSE THE PICTURES WILL BREAK!!
//EVEN AN "INCLUDE" WILL MESS IT UP
//include('SitePHP/buildXHTML.php'); // our call out library


if (!isset($_GET['image'])) {
die();
}
else{
$image = $_GET['image'];
$db_conn = OCILogon("zzzzzzz", "zzzzzzzzz", "zzzzzzz");
if ( ! $db_conn ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$cmdstr = "select THUMB_NAIL from MASTERS.PLUGS where
rep_index='".$image."'";
$parsed = OCIParse($db_conn, $cmdstr);
OCIExecute($parsed, OCI_DEFAULT);
// header ("Pragma: no-cache\n");
header("Content-type: image/jpg");
OCIFetch($parsed);
echo(ociresult($parsed, "THUMB_NAIL")->load());
OCILogoff($db_conn);

}
?>


but i find even if i add "include('SitePHP/buildXHTML.php'); " at the start
of the code , then the routine stops working. ( no errors , but i suspect
the content is messed up, even if the include file is empty)

any ideas



Steve
Steve [ Di, 05 Juni 2007 15:20 ] [ ID #1730578 ]

Re: intersesting problem

steve wrote:
> Hi,
>
> I'm using php 5 zend and oracle.
>
>
> I get a picture into the page using:
>
> <img src="dopic.php?image=REPLIC100450797">
>
>
>
> in my dopic.php , which incidentally took several days to get working.
> I have:
>
>
> <?php
> //DO NOT ADD ANYTHING TO THIS OR REMOVE IT OR ELSE THE PICTURES WILL BREAK!!
> //EVEN AN "INCLUDE" WILL MESS IT UP
> //include('SitePHP/buildXHTML.php'); // our call out library
>
>
> if (!isset($_GET['image'])) {
> die();
> }
> else{
> $image = $_GET['image'];
> $db_conn = OCILogon("zzzzzzz", "zzzzzzzzz", "zzzzzzz");
> if ( ! $db_conn ) {
> echo "Unable to connect: " . var_dump( OCIError() );
> die();
> }
> $cmdstr = "select THUMB_NAIL from MASTERS.PLUGS where
> rep_index='".$image."'";
> $parsed = OCIParse($db_conn, $cmdstr);
> OCIExecute($parsed, OCI_DEFAULT);
> // header ("Pragma: no-cache\n");
> header("Content-type: image/jpg");
> OCIFetch($parsed);
> echo(ociresult($parsed, "THUMB_NAIL")->load());
> OCILogoff($db_conn);
>
> }
> ?>
>
>
> but i find even if i add "include('SitePHP/buildXHTML.php'); " at the start
> of the code , then the routine stops working. ( no errors , but i suspect
> the content is messed up, even if the include file is empty)
>
> any ideas
>
>
>
> Steve
>
>

Is there ANY whitespace at all between the ?> tag and the end of the
include file? If so, it will get output and screw up the image data.

Make sure there is no whitespace anywhere outside of <?php...?>. Try
removing the header() directive, and commenting out the echo command
that spits out the image data. If you load the script in your browser
and see anything at all besides a completely blank document, something
is adding extra crap to the output.

Jeremy
Jeremy [ Di, 05 Juni 2007 22:49 ] [ ID #1730580 ]

Re: intersesting problem

On Wed, 6 Jun 2007 04:49:58 +0800, Jeremy wrote
(in article <10k9i.417698$2Q1.386323 [at] newsfe16.lga>):

> steve wrote:
>> Hi,
>>
>> I'm using php 5 zend and oracle.
>>
>>
>> I get a picture into the page using:
>>
>> <img src="dopic.php?image=REPLIC100450797">
>>
>>
>>
>> in my dopic.php , which incidentally took several days to get working.
>> I have:
>>
>>
>> <?php
>> //DO NOT ADD ANYTHING TO THIS OR REMOVE IT OR ELSE THE PICTURES WILL BREAK!!
>> //EVEN AN "INCLUDE" WILL MESS IT UP
>> //include('SitePHP/buildXHTML.php'); // our call out library
>>
>>
>> if (!isset($_GET['image'])) {
>> die();
>> }
>> else{
>> $image = $_GET['image'];
>> $db_conn = OCILogon("zzzzzzz", "zzzzzzzzz", "zzzzzzz");
>> if ( ! $db_conn ) {
>> echo "Unable to connect: " . var_dump( OCIError() );
>> die();
>> }
>> $cmdstr = "select THUMB_NAIL from MASTERS.PLUGS where
>> rep_index='".$image."'";
>> $parsed = OCIParse($db_conn, $cmdstr);
>> OCIExecute($parsed, OCI_DEFAULT);
>> // header ("Pragma: no-cache\n");
>> header("Content-type: image/jpg");
>> OCIFetch($parsed);
>> echo(ociresult($parsed, "THUMB_NAIL")->load());
>> OCILogoff($db_conn);
>>
>> }
>> ?>
>>
>>
>> but i find even if i add "include('SitePHP/buildXHTML.php'); " at the
>> start
>> of the code , then the routine stops working. ( no errors , but i suspect
>> the content is messed up, even if the include file is empty)
>>
>> any ideas
>>
>>
>>
>> Steve
>>
>>
>
> Is there ANY whitespace at all between the ?> tag and the end of the
> include file? If so, it will get output and screw up the image data.
>
> Make sure there is no whitespace anywhere outside of <?php...?>. Try
> removing the header() directive, and commenting out the echo command
> that spits out the image data. If you load the script in your browser
> and see anything at all besides a completely blank document, something
> is adding extra crap to the output.
>
> Jeremy

Hi,


I thought that crap only got into the output if I wrote it out, using echo
or print .

so are you saying that :
<?php
"a white space in here"
?>



Is enough to trigger the problem?

If so how the hell do you format your code nicely?

Steve
Steve [ Mi, 06 Juni 2007 15:47 ] [ ID #1731495 ]

Re: intersesting problem

Message-ID: <f46dte02t0p [at] news2.newsguy.com> from steve contained the
following:

><?php
>"a white space in here"
>?>
>
>
>
>Is enough to trigger the problem?

No. White space /outside/ the <?php ...?>

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Mi, 06 Juni 2007 19:12 ] [ ID #1731496 ]
PHP » alt.php » intersesting problem

Vorheriges Thema: mail sent; is posssible to have a list?
Nächstes Thema: Timestamp Problem