Names of Images

I created a greeting card using WP. I uploaded the an image titles "cat.jpg" but the image was renamed to "image-57a16266b7b75.jpg". It would be nice to keep the original file name. If "cat.jpg" already exists then it should be named "cat2.jpg"

0
0
Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
thomasmars's picture

Could I ask what the reason for having this naming convention would be ? Is there a special use case for this ?

I guess the reason why it creates a unique hash or id for every image is to avoid additional logic for comparing names of files, but if there is strong incentive for changing the naming convention I guess it could be implemented.

- Thomas

These are the benefits,I was thinking about

- if a user clicks an image, it will be a cleaner url.

- it is easier to locate images and update them through the cpanel or other file manager. 

thomasmars's picture

Sounds reasonable. I'm not sure if there is a good reason for the current naming scheme. Your best bet for getting this implemented is creating a pull request for it or find a developer that can do it.

- Thomas

I will be happy to contribute. I have a degree in IT.  I know the basics of coding. If someone can micro manage me and we take things step by step, I am happy to learn something new.

thomasmars's picture

Excellent, I would start in the h5p editor core within the copy() function where the name is generated.

1 - I checked out the copy() function but I didn't see any hashing function.

2 - I found a hashing function here: https://github.com/h5p/h5p-editor-php-library/blob/c525d15b265984a0757c5...

$libraryData->javascript[md5($lang)] = $lang;

Why is the language variable hashed? What is the value of hashing this?

falcon's picture

If you didn't md5 it you would get a very long string that you tried to use as a key in the array. By md5'ing it you get a unique key for it in the array. I'm there could have been other ways of doing this as well. Haven't been involved in that part of the code.