• 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

Thumbs URLs incorrect with empty "folder_images"

Status
Not open for further replies.

alexvf

Chevereto Member
Hi,

I made some changes to the script to be able to upload the images to the root folder and the thumbs to "[root]/thumbs".

In chevereto.php I changed this line:
Code:
define('__PATH_IMAGES__', __ROOT_DIR__.__FOLDER_IMAGES__.'/');
to this:
Code:
define('__PATH_IMAGES__', __ROOT_DIR__);

In config.php I used these values:
Code:
$config['folder_images'] = '';
$config['folder_thumbs'] = 'thumbs';

Now,
  • the images are uploaded to the root folder correctly;[/*]
  • the thumbs are created and are placed in the "[root]/thumbs" folder correctly;[/*]

But the paths to the "Thumbnail + link" that show up in the Image Viewer are incorrect. The folder "thumbs" is not there.
The paths show up like this:
Code:
HTML: <a href="http://website.com/fsSy3.png"><img src="http://website.com/fsSy3.png" border="0" /></a>
BBCode: [url="http://website.com/fsSy3.png"][img]http://website.com/fsSy3.png[/img][/url]
Thumb URL: http://website.com/fsSy3.png
Instead of this:
Code:
HTML: <a href="http://website.com/fsSy3.png"><img src="http://website.com/thumbs/fsSy3.png" border="0" /></a>
BBCode: [url="http://website.com/fsSy3.png"][img]http://website.com/thumbs/fsSy3.png[/img][/url]
Thumb URL: http://website.com/thumbs/fsSy3.png

Can you please help me on how to correct these thumbnails paths?

Thanks in advance for your help.
 
My PHP knowledge is almost zero, but I think my problem is due to this function in the "class_handler.php" file:
Code:
function get_thumb_url() {
    return str_replace(__FOLDER_IMAGES__, __FOLDER_THUMBS__, Handler::$img_url);
}

For what I was able to understand after a few Google searches, the code tries to find the images folder and replaces it with the thumbs folder. But because there is no value on the __FOLDER_IMAGES__ variable, it does not replace the string.

This function (str_replace()) used here is a bit restrictive since:
1. I can't have an empty value in the __FOLDER_IMAGES__ variable;
2. I can't name the "images folder" with a letter existent on the domain name.

If my domain is "website.com" and I rename the images folder to "i", the img_url and thumb_url will be all messed up because the letter 'i' exists in the domain name.

Is there any hack I can use to make this work using root as the images folder?
 
This is due because how the handler class works. I have modified the handler class and it now supports this kind of folder structure.

You will notice this fix on 2.0.2
 
Status
Not open for further replies.
Back
Top