• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

How to implement Maxcdn

shileno

Chevereto Member
I have an account in Maxcdn and I would like to implement it in my image hosting since now has more than 20,000 images hosted
 
The most easy way is to tweak the handler and the db class.

In class.handler.php
Code:
self::$image_url = absolute_to_url($target['image_path']);

And in class.db.php
Code:
'image_url'            => absolute_to_url($image_target['image_path']),

You should change the function absolute_to_url to something like absolute_to_maxcdn_url

And add a function like this in functions.php:
PHP:
/**
* absolute_to_maxcdn_url
* Converts absolute path to MAXCDN URL
*/
function absolute_to_maxcdn_url($filepath) {
    if(__CHV_ROOT_DIR__===__CHV_RELATIVE_ROOT__) {
        return __CHV_BASE_URL__.ltrim($filepath, '/');
    }
    return str_replace(__CHV_ROOT_DIR__, 'http://cdn.mysite.com/chevereto/', str_replace('\\', '/', $filepath));
}
 
Back
Top