• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

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