Eval'd PHP code version of cdn_pick_server() not working + improve docs
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #956164. --> Reported by: [Duplika](https://www.drupal.org/user/18462) >>> <p>Thanks for this great module Wim. Even newbs like me are able to install and configured this module properly.</p> <p>I need some help being able to use the cdn_pick_server() function, so that Drupal use our different CDN's for all the .js, .css and images, being able to parallelize downloads across different CDNs.</p> <p>I've read the README and used the following code at PHP code for cdn_pick_server():</p> <pre>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Implementation of cdn_pick_server().<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; function cdn_pick_server($servers_for_file) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $filename = basename($servers_for_file[0]['url']);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $unique_file_id = hexdec(substr(md5($filename), 0, 5));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $servers_for_file[$unique_file_id % count($servers_for_file)];<br>&nbsp;&nbsp;&nbsp; }</pre><p>Inside the PHP code for cdn_pick_server(): block without success. Just in case, at the CDN mapping block, I've placed 2 URL's:</p> <pre>http://cdn.mydomain.com<br>http://cdn2.mydomain.com</pre><p>Yet, all our content is being delivered by the first CDN.</p> <p>Any idea or help will be greatly appreciated!</p>
issue