• 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

Change /images/ to Subdomain

im.gg

Chevereto Member
Hi, I would like to know, how do I change img.com/images/xyz.ext to i.img.com/xyz.ext ?

Thanks.
 
When you use the CDN option all the static files will be mapped to CDN URL instead of the system URL so when someone request an image on that CDN URL the image will be served via the CDN URL. The point of doing this is to save system resources, not to make the URL looks prettier. This CDN URL can be either a real CDN or a fake CDN like http://i.img.com/* which maps http//img.com/*. This helps when you want to use a CDN but not all the time so when you know that you will get high traffic you point i.img.com to the CDN IP rather than the website IP.

You can indeed do a lot of weird stuff with CNAMES like point img.com and i.img.com to the same path and with .htaccess rules tell the system to map the i.img.com request to /images/*. Point is that Chevereto allows you to tell which static URL you want to use for the website. You can find more about it here: https://chevereto.com/docs/cdn

By the way, with Chevereto you can also add external servers so you can host images elsewhere (FTP, SFTP, S3, etc.) and if you use a CNAME you can have things like http://img1.img.com which maps to S3, an FTP server, etc.
 
Actually... The current CDN implementation is sitewide, which means that it maps images, javascript, css, etc... Basically all the static resources. This means that /images (or any folder that you choose) will be always displayed in the forms and everything with the local path.

I've realized that there are some features missing regarding image naming and image URL that I could add in next releases, but for now the solution for you is to hack the app/lib/classes/class.image.php class. Look for the function fill() which populates the image URLs and just replace the base_url with your own url.

Find this:
PHP:
$image[$k] = file_exists($v) ? get_image_fileinfo($v) : NULL;

Add below (change to fit your URL):
PHP:
$image[$k]['url'] = str_replace(G\get_base_url(Settings::get('upload_image_path')), 'http://google.com', $image['url']);
 
Back
Top