• 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
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Update from 2.6 and Image routing

V2.X used ?v=name.jpg which is supported in V3. However, your /ID routing is custom made, you will need to manually route the old URLs to new ones.
 
Well, it has been years you know? V2 was deprecated several years ago (2014) and even I do have a hard time remembering how it works.

To be honest, I don't remember how I solved this issue from V2 to V3 and I can't figure out what you could do at this time.

Sorry.
 
thanks for your answer. I know it's very old very but it was corresponding for my use case.
The only problem now it's Flash...


So in wich php file the url is interceped and decoded?

I think write a function for rewrite the url if the decoded id match a image id in the images table.
What do you think about it?
 
Chevereto-Free routes /root to user at app/loader.php (paid edition does it somewhere else).

PHP:
if ($base !== 'index' and !G\is_route_available($handler->request_array[0])) {

If you ask me, it is easier to just write down a server rule for each known ID. That way you won't stress php with the job of redirecting.
 
My job is admin system, not dev...

This is what I do :

PHP:
function chv_decode_id($var) {
    $base_chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // DON'T REPEAT A SINGLE CHAR!
   
    for ($n = 0; $n<strlen($base_chars); $n++) {
        $i[] = substr( $base_chars,$n ,1);
    }
    $lochash = hash('sha256',"fsndbijbfvgsjdncjsd");
    $lochash = (strlen($lochash) < strlen($base_chars)) ? hash('sha512',"fsndbijbfvgsjdncjsd") : $lochash;

    for ($n=0; $n < strlen($base_chars); $n++) {
        $p[] =  substr($lochash, $n ,1);
    }

    array_multisort($p, SORT_DESC, $i);
    $base_chars = implode($i);
   
    $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;
}

$loc_base = "/new/";
$loc_lg_base = strlen($loc_base);
$i_last_id = 3493;
$loc_host = $_SERVER['HTTP_HOST'];
$Uri = $_SERVER['REQUEST_URI'];
$MaVariable = substr($Uri,0,$loc_lg_base);
$loc_proto = "http://";
$loc_coded_id = substr($Uri, $loc_lg_base);
$loc_img_route = "/image/";
if ( $_SERVER['HTTPS'] == "on" ) {
    $loc_proto = "https://";
}

if ($Uri != $loc_base) {
        if ( $MaVariable == $loc_base ) {
            (int) $loc_tstid = chv_decode_id( $loc_coded_id );
            if ( $loc_tstid < ($i_last_id + 1) ) {
                $loc_header = 'Location: ' . $loc_proto . $loc_host . $loc_base . $loc_img_route . $loc_coded_id;
                header( $loc_header );
                exit;
            }
        }
}

I had this code to /index.php (before the define).
 
Back
Top