473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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


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?

Mar 21 '08 #1
17 3865
ur*******@yahoo.com wrote:
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.

--

//Aho
Mar 21 '08 #2
Scripsit ur*******@yahoo.com:
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.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 21 '08 #3
Maybe you should set Content-type in header.
Mar 21 '08 #4
On 21 Mar 2008, ur*******@yahoo.com wrote:
>
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.

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds
Mar 21 '08 #5
On Fri, 21 Mar 2008 15:45:53 +0100, Neredbojias <ex*****@example.com
wrote:
On 21 Mar 2008, ur*******@yahoo.com wrote:
>>
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.
Never had the need for 'ie'-only code. Could you give practical example
when this kind of horror (browser sniffing is usually doomed from the
start) is needed?

(On a sidenote: snipped alt.html, my newsserver doesn't carry it).
--
Rik Wasmus
Mar 21 '08 #6
Neredbojias wrote:
On 21 Mar 2008, ur*******@yahoo.com wrote:
>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.
I've never seen that. How so?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 21 '08 #7
On 21 Mar, 12:10, ur.sol...@yahoo.com wrote:
I have an image being generated by a PHP script--
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">.
Post a URL
Mar 21 '08 #8
..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
Mar 21 '08 #9
On 21 Mar 2008, Jerry Stuckle <js*******@attglobal.netwrote:
>>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.

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.

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds
Mar 21 '08 #10
On 21 Mar 2008, Michael Fesser <ne*****@gmx.dewrote:
.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.
Please see my erudite reply to J. Stuckle for additional convolutions...
<g>

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds
Mar 21 '08 #11
..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
Mar 21 '08 #12
Neredbojias wrote:
On 21 Mar 2008, Jerry Stuckle <js*******@attglobal.netwrote:
>>>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.
I've never seen that. How so?

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.
js*******@attglobal.net
==================

Mar 22 '08 #13
Neredbojias wrote:
On 21 Mar 2008, Michael Fesser <ne*****@gmx.dewrote:
>.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.

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.
js*******@attglobal.net
==================

Mar 22 '08 #14
ur*******@yahoo.com wrote:
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?
This works for me in both.
Obviously there are some bits missing, but the generic header shape is
probably what you want.

image.php
=========

<?php
$id=$_GET['id'];
$query="select picture, picture_filename, picture_size from product
where id='".$id."'";
//echo $query;
$result=mysql_query($query);
if(($result>0) && (($rows=mysql_numrows($result)) == 1)) //got some data
{
$name=mysql_result($result,0,'picture_filename');
$content=mysql_result($result,0,'picture');
$size=mysql_result($result,0,'picture_size');
}
else die();
if ($name="") die();
$mtype=get_mime($name);
header("Content-Type: ".$mtype);
print $content;
?>
mimelib.php
===========

<?php
// looks up mime type in /etc/mime.types and returns the type, or a
default if unmatched
// makes no attempt to interrogate the file content as such.
// THIS NEEDS MORE WORK!!! it doesn't get all types..espcially DWG/DXF!!
// Mind you we don't want to invoke plug-ins for these..
function get_mime($filename)
{
$default="application/force-download";
// first extract the extension
$array=explode(".",$filename); // split the name into the bits
separated by periods
$count=count($array);
if ($count<2) // if there IS NO extension..
return $default; // and let the user sort it out.
$ext=$array[$count-1]; // it will be the last element in the array..
$fp=fopen("/etc/mime.types", "r");
if(!$fp) return ($default); // no /etc/mime.types file
while (!feof($fp))
{
$buffer = fgets($fp, 128);
if (ctype_space($buffer{0}) || $buffer{0}=='#' || $buffer{0}=='\n')
continue; // skip empty lines. or lines starting with spaces
or hashes
sscanf($buffer, "%s %s %s %s %s %s \n",$mime_type,$extension,
$extension1, $extension2, $extension3, $extension4);
if ($ext==$extension || $ext==$extension1 || $ext==$extension2 ||
$ext==$extension3 || $ext==$extension4 )
{
fclose ($fp);
return($mime_type);
}
}
fclose($fp);
return $default;
}
However it WON'T work if invoked directly..it has to be invoked inside
an IMG tag..

Mar 22 '08 #15
On 22 Mar 2008, "rf" <rf@invalid.comwrote:
In this particular case I do really think Neredbojias is actually
wrong. Sorry mate but you really should not look at what the browser
(or whatever) says, you should look inside the file you receive.
When you're at your best, there are few better.

Nevertheless, my code validly did exactly what it was supposed to do,
and it is NOT broken. There may be better ways to check the file mime
type, indeed, but my initial reply was to an original post about a
general image file problem; it's purpose was to suggest a possible
anomoly in that area. Fesser and co. decided to attack my statement
with what I considered an out-of-scope slam having little in the way of
supporting data, demonstrating basically nothing more than egotism via
the effort. It pissed me off because it was just arrogance on the part
of those speaking for purposes of simple self-gratification. You are
familiar with arrogance, are you not? Okay, that barb aside, I do
believe your concerns are generally with alt.html posters'
best-interests at heart. It doesn't, on the contrary, seem so with
these guys.

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds
Mar 22 '08 #16
On Mar 21, 12:10 pm, ur.sol...@yahoo.com wrote:
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?
Try a version of your script image.php
with the name of an image file hard-coded in the script,
and not to need a query string,
and see if it works,
to try to localize the error.
Mar 23 '08 #17
Jukka K. Korpela wrote:
Scripsit ur*******@yahoo.com:
>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.
Even though there's a mistake in the markup (to the OP: the required but
absent ALT attribute), you make *yourself* look clueless. By mentioning
something unrelated to the question asked, you give the impression of
thinking a connection is possible. It isn't, of course, and I'm about as
certain as I can be that you know that.
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.
Heaven forbid you should venture as a possibility the most likely answer.
>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.
He didn't say otherwise. He asked a question.
Jun 2 '08 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Igor Slivka | last post by:
New problem ;). I got script running and showing projects, now i'm trying to show category for every project from another table. I want to do this in new page. Everything is fine except ;))... it...
1
by: news8080 | last post by:
I downloaded a GUI for nagios that uses PHP but when I point the browser at the PHP file, it shows me the source of .php file instead of executing it, if i use command line 'php filname.php'...
3
by: auron | last post by:
Hi there, I have a really stupid and banal problem with showing the results of a MySQL query in PHP, preciselly with MySQL count() function that gives to a variable in PHP the result. NOTE:...
1
by: asllearner | last post by:
I have an htaccess file protected folder. In that folder I have several php files that generate some simple html. When I am logged out, cache cleared, sessions info cleared, I navigate to one of the...
7
by: underground | last post by:
I have a problem that I've spent countless hours on and I'm more than certain this is a obviuos issue to an expert but I am still learning. I have a paging script that I have modified to display a...
3
by: jasone | last post by:
Hello all, I am a complete newbie to mysql / php i have installed apache, php and mysql and they are all working independently and php is working with apache. I have created a database using...
4
by: Tine Müller | last post by:
How can I mix this to one file showing all the markers on Sjælland var xmlfile = ; //Sjælland xmlfile = "map_data_xml.php?category=sh"; xmlfile = "map_data_xml.php?category=sf"; xmlfile =...
2
by: pateldm15 | last post by:
Kindly provide me some links related to php programming. How to install it and configure it. Sites showing examples of php programs
4
by: listovkite | last post by:
I have a strange problem with visualization in Vista and .NET application. Screen from XP http://img502.imageshack.us/my.php?image=xpwv5.jpg Screen from Vista...
11
by: raphsoft | last post by:
Execute a url from php page without showing it. This is what I have: function send_sms($receiver,$content) { $logIn = 'raphael'; $pwd = 'pwd'; $clientId = 'rg7U97fH7fUujp'; //$receiver =...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.