xbgmsharp / piwigo-cdnplus

Piwigo plugin that allow easy CDN integration
http://piwigo.org/ext/extension_view.php?eid=788
GNU General Public License v3.0
0 stars 3 forks source link

Long URLs for images #7

Open elecenet opened 7 years ago

elecenet commented 7 years ago

Hello,

I installed the plugin in my Piwigo (www.elece.net/galeria) with the basic options, that is ACTIVATED checked CDN domain: cdn.elece.net

cdn.elece.net is an Amazon bucket in which I replicated the entire Piwigo directory (galeria/) But then all images are blank. The URL in the page code in an image is, for example, as follows:

src="http://cdn.elece.nethttp://www.elece.net/galeria/http://www.elece.net/galeria/galleries/Gatos/_A030254.jpg"

Really, the images are not uploaded yet. It's a massive load and this is a first test. But the correct path to show the image must be:

http://cdn.elece.net/galeria/galleries/Gatos/_A030254.jpg

I'm configuring something wrong? How I get rid of the extra text in the URL path?

Thank you! Luis

erusso7 commented 7 years ago

Hello, I'm using Piwigo as a backend to my website gallery, and using the WS.

But, I'm having the same problem... the URLs are not correct.

This is my workaround: In the file <piwigo>/plugings/cdnplus/main.inc.php, line 126, replace:

$cdnUrl = $cdnUrl.$conf['cdnplus_conf']['cdn_'.$i]['host'].make_index_url();
$content = $cdnUrl.$content;

With:

$cdnUrl .= $conf['cdnplus_conf']['cdn_'.$i]['host'].'/';
if (strpos($content, '_data') !== false) {
    $content = str_replace(make_index_url(), $cdnUrl, $content);
}

Note: For this moment, I just want to use the cdn URL for the images undex _data folder