By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,101 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,101 IT Pros & Developers. It's quick & easy.

image src and relative path

P: n/a
Hello,

I'm trying to show images that are in a protected directory. I can't move
those images and I can't set the path rights
The path of my script:
home/www/xxxxxxxxxx/web/showimages.php
The path of the images:
home/www/xxxxxxxxxx/stats/image.png

home/www/xxxxxxxxxx/web/ is the root of the website.

Now I've tried so far:
<IMG SRC="../stats/usage.png"//this asks the user and pass for the
protected directory
<IMG SRC="home/www/xxxxxxxxxx/stats/image.png"//this shows
http://www.mysite.com/home/www....in image properties
<IMG SRC="/stats/image.png"//this one also asks for user and pass of the
protected directory.

Si my question is: how to show this image on this page ?

Thanks a lot for helping.

Bob
Dec 20 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
In our last episode, <47***********************@news.sunrise.ch>, the lovely
and talented Bob Bedford broadcast on comp.lang.php:
Hello,
I'm trying to show images that are in a protected directory.
Not possible. Put the images in a world-readable directory or have users
enter username and password. Why in the world would you think otherwise?

You seem to want two contradictory and mutually exclusive things: you want
the images protected (otherwise, why did you put them in a protected
directory?) and you want them publicly accessible (otherwise why do you
object to authentication?) You cannot have both.
I can't move those images and I can't set the path rights
Then copy them to an unprotected directory.
The path of my script:
home/www/xxxxxxxxxx/web/showimages.php
The path of the images:
home/www/xxxxxxxxxx/stats/image.png
home/www/xxxxxxxxxx/web/ is the root of the website.
Now I've tried so far:
<IMG SRC="../stats/usage.png"//this asks the user and pass for the
protected directory
<IMG SRC="home/www/xxxxxxxxxx/stats/image.png"//this shows
http://www.mysite.com/home/www....in image properties
<IMG SRC="/stats/image.png"//this one also asks for user and pass of the
protected directory.
Si my question is: how to show this image on this page ?
Thanks a lot for helping.
Bob

--
Lars Eighner <http://larseighner.com/us****@larseighner.com
Countdown: 397 days to go.
Dec 20 '07 #2

P: n/a
..oO(Bob Bedford)
>Also I've tried to do a "imagepng()" but instead of showing the image it
shows the source of the image.
This means that you've sent an inappropriate HTTP Content-Type header or
none at all, so the server will default to text/plain. Quite easy to fix
with a header() call.

Micha
Dec 21 '07 #3

P: n/a
On Dec 20, 2:57*pm, "Bob Bedford" <b...@bedford.comwrote:
Hello,

I'm trying to show images that are in a protected directory. I can't move
those images and I can't set the path rights
The path of my script:
home/www/xxxxxxxxxx/web/showimages.php
The path of the images:
home/www/xxxxxxxxxx/stats/image.png

home/www/xxxxxxxxxx/web/ is the root of the website.

Now I've tried so far:
<IMG SRC="../stats/usage.png"//this asks the user and pass for the
protected directory
<IMG SRC="home/www/xxxxxxxxxx/stats/image.png"//this showshttp://www.mysite.com/home/www....inimage properties
<IMG SRC="/stats/image.png"//this one also asks for user and pass of the
protected directory.

Si my question is: how to show this image on this page ?

Thanks a lot for helping.

Bob

The usage is something like that;

$url = 'http://username:password@hostname/path?arg=value#anchor';


Dec 21 '07 #4

P: n/a
..oO(Betikci Boris)
>The usage is something like that;

$url = 'http://username:password@hostname/path?arg=value#anchor';
This is not a valid HTTP URL.

You can use something like this inside your script to fetch data from a
remote location, because PHP will automatically turn the credentials
into proper HTTP authentication headers, but for anything else this is
not allowed.

Micha
Dec 21 '07 #5

P: n/a
"Betikci Boris" <pa*****@gmail.comwrote in message
news:1b**********************************@r60g2000 hsc.googlegroups.com...
The usage is something like that;
$url = 'http://username:password@hostname/path?arg=value#anchor';
That'll work - but bear in mind that there's no LESS secure way of sending
passwords than via the URL.
Not only does it go over the net unencoded, but it also remains in a variety
of "history" records.

Dec 22 '07 #6

P: n/a
..oO(Sanders Kaufman)
>"Betikci Boris" <pa*****@gmail.comwrote in message
news:1b**********************************@r60g200 0hsc.googlegroups.com...
>The usage is something like that;
$url = 'http://username:password@hostname/path?arg=value#anchor';

That'll work - but bear in mind that there's no LESS secure way of sending
passwords than via the URL.
Not only does it go over the net unencoded, but it also remains in a variety
of "history" records.
That's why it's not allowed at all in HTTP URLs (there might be other
reasons as well).

Micha
Dec 22 '07 #7

P: n/a
Michael Fesser wrote:
IE doesn't support data URLs.
IE 8 internal betas apparently pass the Acid2 test. Acid2 includes data:.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 3 days, 20:58.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
Jan 3 '08 #8

P: n/a
Toby A Inkster <us**********@tobyinkster.co.ukwrote:
>Michael Fesser wrote:
>IE doesn't support data URLs.

IE 8 internal betas apparently pass the Acid2 test. Acid2 includes data:.
The odd thing is that they are going to include a switch: you can either
set it in Acid2 mode, or you can set it in IE7-with-all-the-warts mode.

I can guess which option will be the default, and it won't be the one that
breaks compatibility with existing IE-specific web sites.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jan 6 '08 #9

P: n/a
Tim Roberts wrote:
The odd thing is that they are going to include a switch: you can either
set it in Acid2 mode, or you can set it in IE7-with-all-the-warts mode.

I can guess which option will be the default, and it won't be the one
that breaks compatibility with existing IE-specific web sites.
Yes, but this is not a configuration setting, but a switch much like
quirks mode / strict mode that's already been in Windows IE since version
6.0 (and Mac IE since 5.0). The user won't be responsible for turning on
standards mode -- the author will be able to do so using some sort of HTML
syntactical nuance.

(From the language they've been using to describe it, it seems likely that
it's not another DOCTYPE-based switch but will more likely rely on a meta
tag or HTTP header.)

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 7 days, 31 min.]

dhyana.pl/0.3
http://tobyinkster.co.uk/blog/2008/01/06/dhyana/
Jan 6 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.