logo       

Re: banner.module and private images: msg#01047

php.drupal.devel

Subject: Re: banner.module and private images

> I decided to give banner.module a try. On the site in question, file
> download will be set to private. This does not make much sense for
> banners, but I can live with the overhead (I think, if you know a
> workaround, let me know).

I just tested this myself, and verified that with the download method set
to private banners are not displayed. Switching it back to public they
are displayed fine. (In file.inc, file_create_url returns a different
path for public and private)

> What worries me is that it does not seem to work. The banner seems to be
> loaded when the page is built up by the browser, but then disappears.

I think what you're seeing is that the browser renders the page knowing
how big the image is, displaying an outline where the banner will go --
when it then fails to load the banner image the outline goes away...

The problem appears to be that the banner module displays the image
directly:
return l("<img src='$filename' border=0 width='$banner->width'
height='$banner->height'>", "banner/$banner->id");

This works great in public mode, where $filename is set as follows:
http://localhost/files/logo.gif

But in private mode, $filename is set to:
?q=system/files&file=logo.gif

Which result in a tag something like:
<img src='?q=system/files&file=logo.gif'>

The image is not displayed in this case. Is this improper use of
file.inc, or is this a bug in file.inc? What's the proper way to display
an image when the download method is set to private?

Thanks,
-Jeremy



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise