IE not showing PHP-generated images, but Firefox does.

U

ur.solame

I have an image being generated by a PHP script--
I didn't write the code-- and the image itself is in a
database.

I've discovered that there is a big discrepancy
between how the images appear in IE7 and FF2,
e.g. for <IMG SRC="image.php?param=foo">.

Namely, they appear just fine in Firefox but
in IE nothing appears at all.

Can anyone tell me know how to make this work
and whether this is a browser issue, a PHP issue,
or what?
 
J

J.O. Aho

I have an image being generated by a PHP script--
I didn't write the code-- and the image itself is in a
database.

I've discovered that there is a big discrepancy
between how the images appear in IE7 and FF2,
e.g. for <IMG SRC="image.php?param=foo">.

Namely, they appear just fine in Firefox but
in IE nothing appears at all.

Can anyone tell me know how to make this work
and whether this is a browser issue, a PHP issue,
or what?

Without seeing the php-script, I would say it's a browser issue.
 
J

Jukka K. Korpela

Scripsit (e-mail address removed):
I've discovered that there is a big discrepancy
between how the images appear in IE7 and FF2,
e.g. for <IMG SRC="image.php?param=foo">.

You could start from using valid markup.

After validating, post the URL.
Namely, they appear just fine in Firefox but
in IE nothing appears at all.

There's something wrong in your markup or in your image data.

To get more specific help, give us more specific data.
Can anyone tell me know how to make this work
and whether this is a browser issue, a PHP issue,
or what?

A browser does not know whether the data comes from a PHP script or from
a "static" file or from a monkey that responds to HTTP requests.
 
N

Neredbojias

I have an image being generated by a PHP script--
I didn't write the code-- and the image itself is in a
database.

I've discovered that there is a big discrepancy
between how the images appear in IE7 and FF2,
e.g. for <IMG SRC="image.php?param=foo">.

Namely, they appear just fine in Firefox but
in IE nothing appears at all.

Can anyone tell me know how to make this work
and whether this is a browser issue, a PHP issue,
or what?

In certain php image manipulations, different code is required for ie than
is for other browsers.
 
A

Adrienne Boswell

Gazing into my crystal ball I observed (e-mail address removed) writing in
I have an image being generated by a PHP script--
I didn't write the code-- and the image itself is in a
database.

I've discovered that there is a big discrepancy
between how the images appear in IE7 and FF2,
e.g. for <IMG SRC="image.php?param=foo">.

Namely, they appear just fine in Firefox but
in IE nothing appears at all.

Can anyone tell me know how to make this work
and whether this is a browser issue, a PHP issue,
or what?

I have seen that happen in IE when there is no height or width
attribute.
 
J

Jerry Stuckle

Neredbojias said:
In certain php image manipulations, different code is required for ie than
is for other browsers.

I've never seen that. How so?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
(e-mail address removed)
==================
 
M

Michael Fesser

..oO(Neredbojias)
In certain php image manipulations, different code is required for ie than
is for other browsers.

Huh? An image is an image. It doesn't matter where it comes from.

Micha
 
N

Neredbojias

I've never seen that. How so?

Har har, you know not what you ask...

Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

....rather explains it.

An image of an unknown type is uploaded. Determining the type produces
different matches on different platforms; "image/pjpeg" on Windows and
"image/jpeg" on non-Windows. This particular code-bit came from a page
receiving images posted by form. Whether it matters elsewhere and
otherwise, who knows. Have a nice day.
 
N

Neredbojias

.oO(Neredbojias)


Huh? An image is an image. It doesn't matter where it comes from.

Please see my erudite reply to J. Stuckle for additional convolutions...
<g>
 
M

Michael Fesser

..oO(Neredbojias)
Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

Not really, it's broken code. You determine the real type of an uploaded
image with getimagesize(). The Content-Type header sent by the browser
is more or less just decoration and should be seen as that. It can be
faked or not available at all, so you can't rely on it.
An image of an unknown type is uploaded. Determining the type produces
different matches on different platforms; "image/pjpeg" on Windows and
"image/jpeg" on non-Windows.

IIRC "image/pjpeg" is sent by IE, but it doesn't matter, since you can
and should ignore it.

And BTW: The thread was about _downloading_ images, not uploading.

Micha
 
J

Jerry Stuckle

Neredbojias said:
Har har, you know not what you ask...

No, I know EXACTLY what I ask. You have no idea what you're saying.
Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

An image of an unknown type is uploaded. Determining the type produces
different matches on different platforms; "image/pjpeg" on Windows and
"image/jpeg" on non-Windows. This particular code-bit came from a page
receiving images posted by form. Whether it matters elsewhere and
otherwise, who knows. Have a nice day.

Nope, it explains your code is broken. NEVER rely on the type of image
indicated by the upload. Check it yourself. You will get the same type
on ALL platforms.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
(e-mail address removed)
==================
 
J

Jerry Stuckle

Neredbojias said:
Please see my erudite reply to J. Stuckle for additional convolutions...
<g>

And the fact your code is broken...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
(e-mail address removed)
==================
 
N

Neredbojias

.oO(Neredbojias)
Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

Not really, it's broken code.
Bullshit.

You determine the real type of an uploaded
image with getimagesize().

No, you don't. There is no filename so how can you?
The Content-Type header sent by the browser
is more or less just decoration and should be seen as that. It can be
faked or not available at all, so you can't rely on it.

Perhaps a brief tutorial on php file uploads will enlighten you:

http://www.tizag.com/phpT/fileupload.php
And BTW: The thread was about _downloading_ images, not uploading.

So? My original comment was "In certain php image manipulations, different
code is required for ie than is for other browsers.".
 
N

Neredbojias

No, I know EXACTLY what I ask. You have no idea what you're saying.

Oh quit being such an asshole.
Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

An image of an unknown type is uploaded. Determining the type
produces different matches on different platforms; "image/pjpeg" on
Windows and "image/jpeg" on non-Windows. This particular code-bit
came from a page receiving images posted by form. Whether it matters
elsewhere and otherwise, who knows. Have a nice day.

Nope, it explains your code is broken. NEVER rely on the type of
image indicated by the upload. Check it yourself. You will get the
same type on ALL platforms.

Not hardly. I _have_ checked it. Come back when you know what you're
talking about.
 
D

dorayme

Neredbojias said:
Oh quit being such an asshole.

Surely you are not referring to... no... I can't believe it...
no... surely not... the lovely, sensitive, Jerry Stuckle? Is this
character doing his usual pissing competition antics?

Boji, let me give you some advice. He is not competitor enough to
waste your energy. He just pisses and has wooden spiels. Telling
him to quit this would be like trying to get Saddam to personally
make and serve breakfast to a Kurd or a Marsh Arab instead of
say, gassing them.
 
M

Michael Fesser

..oO(Neredbojias)
.oO(Neredbojias)
Anyway, _I_ don't know where in that labyrinth of a php manual you'll
find this (-if anywhere), but I'm tired of wasting my own time. This
line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

Not really, it's broken code.

Bullshit.

The code snippet above relies on optional and easy to fake informations.
I could upload an executable or another script which would easily pass
the check. Dependent on the rest of the script it might be even possible
to call that uploaded script, which would be a nice security hole.
No, you don't. There is no filename so how can you?

Of course there is a filename. There might be even two of them: the one
sent by the browser (optional) and the temporary name that PHP assigns
to the uploaded file. So you have the file, you have a name, the storage
location and getimagesize(). That's enough for a _correct_ and reliable
image type check.
Perhaps a brief tutorial on php file uploads will enlighten you:

http://www.tizag.com/phpT/fileupload.php


Yes.

My original comment was "In certain php image manipulations, different
code is required for ie than is for other browsers.".

Still wrong and completely unnecessary. Maybe it's you who should read
something about PHP file uploads? Above is a link to a short tutorial...

Micha
 
N

Neredbojias

.oO(Neredbojias)

Anyway, _I_ don't know where in that labyrinth of a php manual
you'll find this (-if anywhere), but I'm tired of wasting my own
time. This line from the code of one of my old pages:

if (!($_FILES['filup']['type'] == "image/jpeg" ||
$_FILES['filup']['type'] == "image/pjpeg")) {

...rather explains it.

Not really, it's broken code.

Bullshit.

The code snippet above relies on optional and easy to fake
informations. I could upload an executable or another script which
would easily pass the check. Dependent on the rest of the script it
might be even possible to call that uploaded script, which would be a
nice security hole.

The following 2 links relate, and the second illustrates the security
point you are making:

http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=php

http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=security

Had you provided some useful information in the first place instead of
attacking my code as "broken" _which it is not_, this argument could
have been avoided. Please don't be so goddamn pedantic in the future!
Of course there is a filename. There might be even two of them: the
one sent by the browser (optional) and the temporary name that PHP
assigns to the uploaded file. So you have the file, you have a name,
the storage location and getimagesize(). That's enough for a _correct_
and reliable image type check.

I should have said there is no "filename" - meaning no file with
"filename". The check occurs before moving and relabelling. The file
has a _tmp_ name at the point of my example code which I presume (as you
suggest) can be used for the getimagesize() verification.

....snip
Still wrong and completely unnecessary. Maybe it's you who should read
something about PHP file uploads? Above is a link to a short
tutorial...

Not wrong at all though the "necessity" is arguable. I do admit that
one should rely on getimagesize() for safety's-sake.
 
N

Neredbojias

Surely you are not referring to... no... I can't believe it...
no... surely not... the lovely, sensitive, Jerry Stuckle? Is this
character doing his usual pissing competition antics?

Boji, let me give you some advice. He is not competitor enough to
waste your energy. He just pisses and has wooden spiels. Telling
him to quit this would be like trying to get Saddam to personally
make and serve breakfast to a Kurd or a Marsh Arab instead of
say, gassing them.

But but but - Michael Fesser and he are in agreement. Er, sort of.
However, I really think ol' Jer is just parroting one side of an argument
just to stroke the ol' ego, so to speak. I don't give a shit, nor will I
take it; it's no more Mr. Nice Guy from now on. I know what I can do, and
while not perfect, my output beats most anything from anybody else that
I've seen. Another thing is it's fine to criticize, but without providing
some truly _constructive_ information in the process, you're just blowing
your own horn. And to wit, there are a lot of horn-blowers here, -even
fairly intelligent ones.

Thanks for the advice, do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top