• 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.

Image URL

yadenisenko

Chevereto Member
Hello Please tell me how to do that would be short image url and Viewer kept on one character and example jhsdgfbsd
Sorry for my English, I'm from Russia
 
Code:

PHP:
function chevereto_id($var, $action='encode') {
    $base_chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // DON'T REPEAT A SINGLE CHAR!
   
    for ($n = 0; $n<strlen($base_chars); $n++) {
        $i[] = substr( $base_chars,$n ,1);
    }
 
    $passhash = hash('sha256',__CHV_CRYPT_SALT__);
    $passhash = (strlen($passhash) < strlen($base_chars)) ? hash('sha512',__CHV_CRYPT_SALT__) : $passhash;
 
    for ($n=0; $n < strlen($base_chars); $n++) {
        $p[] =  substr($passhash, $n ,1);
    }
 
    array_multisort($p, SORT_DESC, $i);
    $base_chars = implode($i);
   
    switch($action) {
        case 'encode':
            $string = '';
            $len = strlen($base_chars);
            while($var >= $len) {
                $mod = bcmod($var, $len);
                $var = bcdiv($var, $len);
                $string = $base_chars[$mod].$string;
            }
            return $base_chars[$var] . $string;
        break;
        case 'decode':
            $integer = 0;
            $var = strrev($var );
            $baselen = strlen( $base_chars );
            $inputlen = strlen( $var );
            for ($i = 0; $i < $inputlen; $i++) {
                $index = strpos($base_chars, $var[$i] );
                $integer = bcadd($integer, bcmul($index, bcpow($baselen, $i)));
            }
            return $integer;
        break;
    }
 
Guys, Chevereto doesn't use pad up and the short URL is NOT TO HIDE the images!. You will do a lot with pad up, aesdfYYnb vs YYnb.. Like no one will guess what is the pad up.
 
Hello.
See, well, this is too short url, anyone can see the brute force http://llln.ru/J if he was such http://llln.ru/JKdn3 then it would be difficult to find

Like I said before, the short url purpuse is get a short url, period. The purpose of the short url never has been hide the images or add a layer of pricacy. Privacy will be added with password protected images in v3.
 
The new version of Chevereto, in the admin part all files are opened as domen.com/XXX, how do as in the "old" version - domen.com/images/0000/00/00/XXXXXXXX.xxx?
 
I edit admin/content/system/js/admin.js
Code:
file_html =
                    '<div class="'+list_item.replace(".", "")+'" id="'+value.image_id+'">\
                            <a class="title link" href="'+value.image_shorturl+'" target="_blank">'+image_name+'</a><span class="'+checkbox_class+'"></span>\
                            <div class="thumb">\
                                <img src="'+value.image_thumb_url+'" alt="" width="'+th_width+'" height="'+th_height+'" />\
                                <span class="attr">'+value.image_width+'x'+value.image_height+'</span>\
                                <span class="size">'+value.image_size+'</span>\
                            </div>\
                            <div class="date">'+value.image_date+'</div>\
                      </div>';

to

Code:
file_html =
                    '<div class="'+list_item.replace(".", "")+'" id="'+value.image_id+'">\
                            <a class="title link" href="'+value.image_url+'" target="_blank"><b>'+image_name+'</b></a><span class="'+checkbox_class+'"></span>\
                            <div class="thumb">\
                                <img src="'+value.image_thumb_url+'" alt="" width="'+th_width+'" height="'+th_height+'" />\
                                <span class="attr">'+value.image_width+'x'+value.image_height+'</span>\
                                <span class="size">'+value.image_size+'</span>\
                            </div>\
                            <div class="date">'+value.image_date+'</div>\
                      </div>';

result - url not change, nothing not changed
 
Back
Top