ElkArte Community

Extending Elk => Addons => Topic started by: emanuele on July 28, 2014, 04:09:25 pm

Title: [ADDON] Image caching
Post by: emanuele on July 28, 2014, 04:09:25 pm
Image caching v0.1.0
When using HTTPS connections the browers usually do not show external images embedded with the img tag that link to HTTP urls because they breach the security of the page.

This addon, when necessary, fetches a preview of the image, stores it in the cache directory and shows it in place of the original image, along with a message (added through javascript) that instruct the members and visitors to click to see the image at it's original size.

It's a very basic implementation without any setting, more will come.

Future development:


License
o This ElkArte Addon is subject to the terms of the BSD "3-clause" license. You can obtain a copy of the License at http://opensource.org/licenses/BSD-3-Clause

Repository / Download



Change log

  • 0.1.0 - Initial commit
Title: Re: [ADDON] Image caching
Post by: Adrek on April 30, 2015, 09:06:13 pm
This mod should get preview from image that is using http:// url?
Title: Re: [ADDON] Image caching
Post by: meetdilip on May 02, 2015, 08:15:22 am
Quote from: phantom – This mod should get preview from image that is using http:// url?
looks like it

@emanuele @Spuds

Is it for HTTP to HTTPS conversion scenario ?
Title: Re: [ADDON] Image caching
Post by: Spuds on May 02, 2015, 08:55:47 am
AFAIK, if you are using an httpS connection to a site, and say you embed an image in a post to a 3rd party site like http:\\some.image.here  its not going to show up.   That is due to the httpS connection, its is not going to fetch that image since its not part of the secure connection.

The work around is to have the server fetch the image from the 3rd party, cache it, and them send it over the S connection.
Title: Re: [ADDON] Image caching
Post by: emanuele on May 02, 2015, 09:19:04 am
Yep, that's what it is supposed to do.
Title: Re: [ADDON] Image caching
Post by: meetdilip on May 02, 2015, 03:10:15 pm
Thanks @Spuds @emanuele
Title: Re: [ADDON] Image caching
Post by: Adrek on May 02, 2015, 03:13:48 pm
I think that it's not working correctly.

When i post http:// image there is no difference with or without this addon. If you need I can give you account to test it on my site.

//edit 1
I replaced
Code: [Select]
if (!($parseboard['scheme'] === 'http' || $parseboard['scheme'] === $parseimg['scheme']))
with
Code: [Select]
if (!($parseboard['scheme'] === 'https' || $parseboard['scheme'] === $parseimg['scheme']))

and it seems to work now, but is this 'fix' really fixing it?

//edit 2

and package-info.xml is missing instructions for language file :)
Title: Re: [ADDON] Image caching
Post by: emanuele on May 02, 2015, 04:15:21 pm
Indeed the fix is a proper fix.

And... well, did I already say anyone I do not test most of the code I write? Thanks for the report! :D
I'll fix both ASAP (i.e. not now, but hopefully in the next week or so).
Title: Re: [ADDON] Image caching
Post by: Adrek on May 02, 2015, 04:27:14 pm
good to know :) Thanks
Title: Re: [ADDON] Image caching
Post by: kucing on March 30, 2016, 08:01:26 pm
Hi, I just activated this addon and if I understand it correctly this will show the images as thumbnail in the post? when it's clicked it will opens original source url not the cache?
Title: Re: [ADDON] Image caching
Post by: emanuele on March 31, 2016, 02:25:02 am
Yes.
To me there are few implications nowadays about copyright and storing images "belonging" to external websites, even is only in the form of a "cached" image. So the safest solution was to fetch only a thumbnail (i.e. fine in most of the cases by the fair use principle) and open up the original one for the original.
Title: Re: [ADDON] Image caching
Post by: kucing on March 31, 2016, 09:57:39 pm
Quote from: emanuele – Yes.
To me there are few implications nowadays about copyright and storing images "belonging" to external websites, even is only in the form of a "cached" image. So the safest solution was to fetch only a thumbnail (i.e. fine in most of the cases by the fair use principle) and open up the original one for the original.
thanks for the explanation, then i misunderstood about the function. haha. :D
Title: Re: [ADDON] Image caching
Post by: emanuele on April 01, 2016, 03:10:24 am
What you were looking for?
Title: Re: [ADDON] Image caching
Post by: shaitan on February 22, 2017, 01:38:53 pm
French translation in attachment