Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

PHP thumbnail generation and img tag
Welcome, Guest. Please login or register.
December 02, 2008, 11:34:09 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Serverside Technology  |  PHP  |  PHP thumbnail generation and img tag « previous next »
Pages: [1]
Author Topic: PHP thumbnail generation and img tag  (Read 1652 times)
Solamnus

Offline Offline

Posts: 4


« on: August 21, 2007, 07:20:53 AM »

Hello guys,

i have made an img.php that generates thumbnails for my images, and resize big images to 640x480.
i use

header('Content-Disposition: inline; filename=' . $fn); //$fn stands for file name

to save images with their original names while using Save As.

But when i add the images into another page with img tag it Save As doesnt work as expected.

Here are 2 URLs one to a pop up page. and one to the image itself.
http://online.rek-man.com/pop.php?path=/REFLEX%20STOKLAR%20(AVRUPA)/50492_1_RGB.jpg&rt=stok
http://online.rek-man.com/inc/img.php?img=/REFLEX%20STOKLAR%20(AVRUPA)/50492_1_RGB.jpg&rt=stok

what can be wrong?

Logged
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #1 on: August 21, 2007, 09:36:01 AM »

This works: http://www.cafesong.com/test/phpImageStream.php

Code:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP Image Stream</title>
</head>

<body>
<code>

</code>
<p><img border="0" src="http://online.rek-man.com/inc/img.php?img=/REFLEX STOKLAR (AVRUPA)/50492_1_RGB.jpg&rt=stok"></p>

<p><iframe name="I1" src="http://online.rek-man.com/inc/img.php?img=/REFLEX STOKLAR (AVRUPA)/50492_1_RGB.jpg&rt=stok">Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p>

</body>

</html>
Logged

Rod
Solamnus

Offline Offline

Posts: 4


« Reply #2 on: August 22, 2007, 01:05:56 AM »

thanks for your reply, your solution works on firefox but does not work on IE6 or IE7.
Unfortunately i am looking for a IE solution to my problem.

Thanks again.
Logged
GrandSchtroumpf
Mentor

Offline Offline

Posts: 410



« Reply #3 on: August 22, 2007, 03:13:31 PM »

> your solution works on firefox
Nice, i did not know you could do that.  It also works in Opera and Konqueror.

> but does not work on IE6 or IE7.
I'm afraid you won't be able to fix IE flaws in your HTML/PHP.
Logged
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #4 on: August 22, 2007, 08:30:26 PM »

thanks for your reply, your solution works on firefox but does not work on IE6 or IE7.
Unfortunately i am looking for a IE solution to my problem.

Thanks again.

I beg to differ:

Logged

Rod
Solamnus

Offline Offline

Posts: 4


« Reply #5 on: August 23, 2007, 12:32:06 AM »

@rdivilbiss

my problem is not to show the image properly. When you right click image and select "Save as" in IE it tries to save the image as "untitled.bmp" i want it to save the image with its original name and format(jpg).
Logged
GrandSchtroumpf
Mentor

Offline Offline

Posts: 410



« Reply #6 on: August 23, 2007, 02:00:24 AM »

I guess you need to use mod-rewrite to make it work in IE.

With mod-rewrite, you can pass your parameters as "directories" and keep the original file name:
http://online.rek-man.com/pop/stok/REFLEX%20STOKLAR%20(AVRUPA)/50492_1_RGB.jpg
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #7 on: August 25, 2007, 07:01:57 AM »

Solamnus, I had this problem (IE6 at the time) and tried all combinations of content-disposition ; inline ; attachment ; various HTTP headers ; filename= etc etc ad nauseam.

I failed. J'ai renoncé.

I suggest you stop losing your time on this IE specific bug. I suggest to add a small-cap message near the images saying (for IE users only, of course) "if your "save as" brings up "untitled.bmp", there's nothing we can do about it. Change for a real browser : Mozilla Firefox."
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
Solamnus

Offline Offline

Posts: 4


« Reply #8 on: August 27, 2007, 12:53:19 AM »

@VGR

well i have my work around ready... i am passing the real url of the image, resize proportionally then resize the po up window according to the image. It makes user download more data and that must be the punishment for not using a real browser.

Thanks to everyone who replied.

Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #9 on: August 27, 2007, 04:03:35 AM »

this is not really a workaround for the IE problem with "save as" file names, is it ? ;-)
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
oridan

Offline Offline

Posts: 1


WWW
« Reply #10 on: October 26, 2007, 07:38:00 AM »

This happens if you send Cache-Control headers prior to initialising the session, and then send further headers after.
From what i know, this happens because in some cases, these initial headers are sent to the browser before they get overwritten later in your php code.  Evidently, IE doesnt handle multiple headers with the same key in the same way that Firefox does.

I've had this problem for ages I got around this by moving all my header code after the session is started.  However its far better not to send multiple headers with the same key unless you really need to.

Hope this helps some people, its been a thorn in my side for quite some time!

Tom
« Last Edit: October 26, 2007, 07:48:11 AM by oridan » Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #11 on: November 11, 2007, 12:47:29 PM »

hummmm "cache-control" header serttings mangling "content-disposition" ones ? hummmm are you sure ?
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
Pages: [1]
« previous next »
    Jump to: