Can use Add Media->Hotlink to files on my local server

Found a bug? Tell us!!
Post Reply
Guest

Can use Add Media->Hotlink to files on my local server

Post by Guest »

I have S9y installed in /blog of my webroot, and gallery installed in /gallery with its albums in /albums.

I am trying to use the Media->Add Media option to make a hotlink with thumbnail, so I can use the pretty "Manage Media" option in the WYSIWYG editor.

This works for images at external sites, but when I try to point to the full URL of an image stored in my album (http://mywebsite.com/albums/album01/100_1260.jpg) and select Hotlink to Server I get:
Adding image...

File was not located on the remote server, are you sure the URL: http://mywebsite.com/albums/album01/100_1260.jpg is correct?
I know it isn't a rights issue as I can just display http://mywebsite.com/albums/album01/100_1260.jpg using the Inset Image tool.

Suggestions?

-Rob A>
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can use Add Media->Hotlink to files on my local serve

Post by garvinhicking »

The error you are getting can only happen, if the URL you specified does not exist or does not return a 200 HTTP response, or if your webserver does not allow requests to its own webpage via firewalling.

If you give us the right URL to your website, we can help you further. It is definitely a access rights issue.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Re: Can use Add Media->Hotlink to files on my local serve

Post by Guest »

garvinhicking wrote: It is definitely a access rights issue
Thanks Garvin -

That is exactly the pointer I needed to resolve.

Some time ago I had followed the directions at the Gallery web site http://gallery.menalto.com/modules.php? ... curing.php to prevent image theft my modifying the album .htaccess file like so:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.mydomain/gallery.*$ [NC] [OR]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/gallery.*$ [NC] [AND]
RewriteCond %{REQUEST_FILENAME} ^.+jpg [NC]
RewriteRule ^.*$ http://www.mydomain.com/not_allowed.gif [R,L] 
For now I've turned this rule off, but when I have a moment I'll check the reqrite logs to see that the referred is... It could be because this server is running using dynamic dns...

Thanks,
Rob A>
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can use Add Media->Hotlink to files on my local serve

Post by garvinhicking »

Then that's easy to resolve.

When serendipity fetches a hotlinked image it does not propagate a HTTP-REFERER string. Thus your .htaccess rule block out your own Serendipity.

You can grant access to your own server IP to bypass this behaviour:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.mydomain/gallery.*$ [NC] [OR]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/gallery.*$ [NC] [AND]
RewriteCond %{REQUEST_FILENAME} ^.+jpg [NC] [AND]
RewriteCond %{REMOTE_ADDR} !192.168.0.1
RewriteRule ^.*$ http://www.mydomain.com/not_allowed.gif [R,L] 
Replace 192.168.0.1 with your server IP.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

RobA, then you've got a problem and you'll need to regenerate your .htaccess after each new dynamic DNS assignment. OR you need to remove your Image-Theft code.

Also, I think I have discovered a few bugs in the way the Manage Images widget handles hotlinks (All my testing was with this image of mine...http://www.maj.com/gallery/ffaat/Astro/100_0699.jpg so seel free to duplicate it.

1.) This indeed looks like a bug to me. I will insert this into our bugtracker.

2.) Yes, hotlinked images do not create preview images on the server, so this is "by design". If you need scaled images, you can't do hotlinking.

3.) Yes, you are right, there is not really much that can be done about that as the paths on a hotlinked server do not map on the virtual server. But I'll see if a "faked" directory assignment can be achieved.

About the full size image: We developer strongly belief in the W3C-supported notion that browsers should indicate where to open links (new image or browser) and thus are not supporting to add a "target" attribute, which is deprecated in later XHTML versions.

Great that you seem to enjoy using Serendipity! Many thanks for your good feedback, I will try to get it implemented soon!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

RobA: But this is just a faked preview. The images are loaded as fullsize and the browser scales them down - pretty badly.

In fact the option to display an image as thumbnail should not be available for a hotlinked file.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply