Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorter URL / Filename #16

Closed
crunchprank opened this issue Jun 20, 2015 · 2 comments
Closed

Shorter URL / Filename #16

crunchprank opened this issue Jun 20, 2015 · 2 comments

Comments

@crunchprank
Copy link

What and where about in the PHP script would I change if I'd like to shorten the generated filename? After digging around a bit, it looks like it's using the MD5 of the image file to generate the name? I'd like to be able to shorten it to the length of imgur's (e.g. imgur.com/s9K5x.png). Thanks for your help!

@ziggi
Copy link
Owner

ziggi commented Jul 1, 2015

You can try make this changes (I have not test it, but it should work):

https://github.com/ziggi/zimg-host/blob/master/upload.class.php#L71

$new_name = hash('crc32b', microtime() . $urls_array[$i] . rand(0, 9999)) . '.' . $this->_allowed_types[ $array_result[$i]['type'] ]['file_format'];

https://github.com/ziggi/zimg-host/blob/master/upload.class.php#L142

$new_name = hash('crc32b', microtime() . $files[$i]['name'] . $files[$i]['tmp_name'] . rand(0, 9999))  . '.' . $this->_allowed_types[$type]['file_format'];

I will make those changes later.

@crunchprank
Copy link
Author

Tested and working. Thanks!

ziggi added a commit that referenced this issue Jul 8, 2015
@ziggi ziggi closed this as completed Jul 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants