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

How to decode Image IDs in URLs?

rmallory

Chevereto Member
Hello Again,

I have a new question. I'm wondering if there is a way to use the actual image and album IDs (the integers) in a URL rather than the encoded IDs.

So I'm wanting to change this:
http://example.com/image/R
to this:
http://example.com/image/2
(assuming the image ID is 2)

Does anyone know if this is possible, and if so are there any performance or security concerns with this setup?

I'm asking because I need a way to associate user created URLs back to the user that created them. So that if I had a list of all URLs, I could associate any user created URLs to their publishing user. Maybe there is a better way?

Please let me know if you have any ideas.

Best,
RDM
 
Sure is possible but is not wise to do it. The point of using an alphanumeric representation is to avoid enumeration and the system uses the same method that you can see in YouTube.

If you want to use the real id you will need to lookup for the calls of the encodeID() and decodeID() functions. That will give you an insight on where the ids are decoded/encoded in the source code.

Hope it helps.
 
In that case you need to parse the list as an array using explode(), then with a loop you can do those changes.
 
Hello @rmallory, could you share your work or is there a way to make longer more unique image id's? i have got the problem that some link-grabbing scripts visit my sites and they index letter for letter - that' is not so cool -.-
 
Hello @rmallory, could you share your work or is there a way to make longer more unique image id's? i have got the problem that some link-grabbing scripts visit my sites and they index letter for letter - that' is not so cool -.-

Chevereto now has id padding (key id_padding), which allows to add a fake upscaled ID, check it at chv_settings table.
 
the padding only works if you use a new galery , couse every link is rewritten by that.. :(
but nice feature - for next website i will use it :)

Padding works only for new installations, old installations have untouched that otherwise dozens of links will be lost. You can hack the system and add a forced id padding, just look for "padding" in the chv_settings table.
 
Solution: Upload a new picture, go to PhpmyAdmin > Table: chv_images > order by image_id > take the last one > multiplicate the id with a factor you want and save > what next comes is magic :)
 
Solution: Upload a new picture, go to PhpmyAdmin > Table: chv_images > order by image_id > take the last one > multiplicate the id with a factor you want and save > what next comes is magic :)

That's not the way to do it and I will like to not encourage that method. The way to deal with this is simply go to chv_settings and locate this setting_name = id_padding and set the setting_value to any large number you want.
 
hola rodolfo, it's not possible without loosing the links to your old images. you have written on post above - my solution is only for experienced users .. and I'm happy with it.. by now ...
 
hola rodolfo, it's not possible without loosing the links to your old images. you have written on post above - my solution is only for experienced users .. and I'm happy with it.. by now ...
In that case you need to alter the table and increase the auto_increment value.
 
Is the same thing, you created a gap altering the image_id of the last record, is almost the same thing as change the table AUTO_INCREMENT value.
 
sure you are the best rodolfo - here the sql code:
Code:
ALTER TABLE 'chv_images' AUTO_INCREMENT = 1000000000;

URL's now looks like: chvereto.url/image/XXxxxx < exactly what i wanted :)
 
Hi, Is there any simple way to find from image Id to image url ? I need to do that because the search function can't find image name like "xr2017-1216-4". I can find it from phpmyadmin in chv_images table but I still could not find the image url ? I need to find them then I can delete it from user interface not from mysql.
 
Back
Top