Names of Images
Submitted by alkanadi on Tue, 08/09/2016 - 09:20
Forums:
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"
thomasmars
Tue, 08/09/2016 - 11:12
Permalink
Hi,
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
alkanadi
Tue, 08/09/2016 - 16:09
Permalink
These are the benefits,I was
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
Wed, 08/10/2016 - 09:52
Permalink
Thanks,
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
alkanadi
Thu, 08/11/2016 - 15:51
Permalink
I will be happy to contribute
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
Fri, 08/12/2016 - 09:59
Permalink
Excellent, I would start in
Excellent, I would start in the h5p editor core within the copy() function where the name is generated.
alkanadi
Sun, 08/14/2016 - 18:11
Permalink
1 - I checked out the copy()
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
Mon, 08/15/2016 - 09:05
Permalink
If you didn't md5 it you
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.