[ale] PHP hates JPG
James Sumners
james.sumners at gmail.com
Wed Nov 26 11:57:06 EST 2008
echo '<img src="../images/I/' . $ID . '/' .
htmlentities($row1['FileName']) . '" alt="">';
You need to quote the array index if it is a named index. The call to
htmlentities() should fix any problems with odd file names (spaces,
etc.). Other than that, there is nothing you have shown us that would
cause PHP to parse the image as code. You are merely working with
text. If you are having a problem with the image being parsed as code,
the culprit is in another block.
2008/11/26 Jim Kinney <jim.kinney at gmail.com>:
> echo "<img src=\"../images/l/$ID/{$row1[FileName]}\" alt=\"\">";
>
> where FileName is the array descriptor and $row1 is the dataset from the
> query.
>
> It works fine for most jpg's but not for all.
>
> 2008/11/26 David Tomaschik <david at tuxteam.com>
>>
>> How are you handling the file? A code snippet might help.
>>
>> David
>>
>>
>> 2008/11/26 Jim Kinney <jim.kinney at gmail.com>
>>>
>>> Why does PHP try to eval a jpg file?
>>>
>>> I am using php to build a web page (duh!). The images are placed based on
>>> a database lookup for the images file name. Apparently, once php gets that
>>> file name it parses it as more php code. So any jpg with a ?> or other php
>>> indicator character pattern is not displayed and my httpd error logs file
>>> with "PHP Warning: Unexpected character in input: '\x07' (ASCII=7) state=1
>>> .." messages.
>>>
>>> I _KNOW_ php can do this properly as a gazillion sites do this all the
>>> time.
>>>
>>>
>>> ?????Puzzled?????
>>>
>>> --
>>> --
>>> James P. Kinney III
>>>
>>>
>>> _______________________________________________
>>> Ale mailing list
>>> Ale at ale.org
>>> http://mail.ale.org/mailman/listinfo/ale
>>>
>>
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>>
>
>
>
> --
> --
> James P. Kinney III
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
>
--
James Sumners
http://james.roomfullofmirrors.com/
"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."
Missionaria Protectiva, Text QIV (decto)
CH:D 59
More information about the Ale
mailing list