Welcome to the Koken CMS community!

Here at KCS, you will find a friendly bunch of photographers who like to share their love for the Koken CMS. We hope that you will enjoy your time here and thrive in our community!

You asked for it: Donations!
You asked for it, and it's here: The possibility to "buy me a beer (or more)"!

Seriously: By giving a small paypal donation you will help with keeping this site afloat and also give me more incentive to develop OxyGen further... ;)

// Bjarne Varöystrand and the KCS Team
Koken Development

CDN plugin not working correctly

Questions regarding custom Koken theme and plugin development.

This is the place to start out from when you are creating your own themes and/or plugins
Documentation

Forum rules
As of late, we have been seeing cases where some of you have been posting multiple types of questions within a singular type of topic...

This makes searching here a nightmare for people whom are attempting to find out whether or not their question has already been asked, or possibly even answered. Therefore, I would like to implement some very basic rules, which I think everybody will be happy with, given that they will lead to better search results.

  1. All public communication is done in English
  2. ONE question per topic
  3. Make the title descriptive
  4. If it's regarding a theme: make sure you mention the theme name.
  5. Leave a URL to your site, since sometimes, custom "hacks" and CSS will be uniqe to your site.

I believe that these simple rules will not only make our lives easier, but also the lives of our visitors :D

I am of the opinion that ignoring these requests will make it harder for us all.
Plus, we won't be able to actually mark an issue/topic as solved, since it would be more difficult to determine what we're actually trying to solve! For example: Are we addressing the first, second or third question?
User avatar
cielitolindo
Developer
Developer
Posts: 11
Joined: Sat 21 May 2016, 00:15
Your name: JM

CDN plugin not working correctly

Postby cielitolindo » Thu 27 Jul 2017, 08:23

Hi,

I'm using the CDN Plugion Version 1.1 on my site (template chastain and koken version 0.22.23) and noticed that not all the images are routed over the cdn server but still directly from my hosting site.

Inside the admin-panel and the lightboxes images (jpg-files) are saved via the cdn server.
What doesn't work is getting the images on the albums (overview)- page and when viewing the album. (I can see this through eg. Firebug).

When viewing the source code I see (eg.):

Code: Select all

<li>
   <span class="img-wrap">
   
   <a href="/albums/mix/content/p1080589/lightbox/" class="k-link-lightbox" title="View  in Gallery">
   <noscript>
   <img width="100%" class="content lbox" alt="P1080589.jpg" src="https://1866016286.rsc.cdn77.org/storage/cache/images/000/205/P1080589,large.1478203699.jpg" />
</noscript>
<img class="content lbox" data-alt="P1080589.jpg" data-visibility="public" data-respond-to="width" data-presets="tiny,60,45 small,100,74 medium,480,356 medium_large,800,594 large,1024,761 xlarge,1600,1188 huge,2048,1521" data-base="/storage/cache/images/000/205/P1080589," data-extension="1478203699.jpg"/>

   </a>

   </span>

   <span class="img-data">
   <span class="img-caption">
   <h4><a href="/albums/mix/content/p1080589/" title="View" data-koken-internal></a></h4>
   </span>
   </span>
   </li>


When viewing the code via Firefox Developer tools I see (eg.)

Code: Select all

<li>
   <span class="img-wrap">
   
   <a href="/albums/nature/content/p1270349-1/lightbox/" class="k-link-lightbox" title="View  in Gallery">
   
<img class="content lbox" data-visibility="public" data-respond-to="width" data-presets="tiny,60,45 small,100,75 medium,480,360 medium_large,800,600 large,1024,769 xlarge,1600,1201 huge,2048,1537" data-base="/storage/cache/images/000/426/P1270349," data-extension="1500911108.jpg" alt="P1270349.jpg" data-longest-side="1600" src="/storage/cache/images/000/426/P1270349,xlarge.1500911108.jpg" width="1066" height="800">

   </a>

   </span>
   <span class="img-data">
   <span class="img-caption">
   <h4><a href="/albums/nature/content/p1270349-1/" title="View" data-koken-internal=""></a></h4>
   </span>
   </span>
   </li>


So what I see is that the link in the noscript-part is replaced correctly by the plugin but the src-link in the img class="content lbox" not.

AFAIK this worked some time ago.

Have there been some changes in koken lately or am I doing something wrong?

Greetings
Cielitolindo
User avatar
cielitolindo
Developer
Developer
Posts: 11
Joined: Sat 21 May 2016, 00:15
Your name: JM

Re: CDN plugin not working correctly  Topic is solved

Postby cielitolindo » Thu 27 Jul 2017, 21:06

Hi,

seems that I fixed it.

I extended the plugin by the following code in the function render_site

Code: Select all

                if ($this->data->cdn_image==1) {
          $pattern[] = '/(data-base=")(\/[^\/][^"]+")/';
                    $replacement[] = $std_replacement;
                }


If the change proves to work then I'll update the github project later on.

Greetings
Cielitolindo
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: CDN plugin not working correctly

Postby Bjarne Varöystrand » Fri 28 Jul 2017, 00:01

Thank you for sharing the solution JM! :)
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image

  • Similar Topics
    Replies
    Views
    Last post
  • Cart plugin
    by thp » Yesterday, 09:17 » in Plugins
    2
    50
    by thp View the latest post
    Today, 04:55
  • Instagram plugin
    by faustvasea97 » Mon 01 Oct 2018, 22:11 » in General Errors and usage problems
    4
    650
    by Bjarne Varöystrand View the latest post
    Wed 16 Jan 2019, 00:58
  • cart plugin
    by jphillips » Sun 16 Sep 2018, 16:02 » in Plugins
    2
    941
    by jphillips View the latest post
    Fri 21 Sep 2018, 19:58
  • Image protector plugin
    by faustvasea97 » Wed 06 Feb 2019, 22:15 » in Installation and Setup
    2
    316
    by faustvasea97 View the latest post
    Tue 12 Feb 2019, 14:52
  • Image tittle on password plugin.
    by faustvasea97 » Sat 06 Oct 2018, 13:05 » in Site Publishing
    2
    646
    by faustvasea97 View the latest post
    Fri 12 Oct 2018, 08:46

Return to “Custom theme and Plugins”



Who is online

Users browsing this forum: No registered users and 1 guest