1

I'm allowing members to upload images. Is there a way to tell EE that the uploaded files should be assigned a randomized filename? I need this feature for privacy reasons and to prevent collisions.

I'm using Safecracker and Matrix, if that matters.

5
  • If you are using CE image on front end, you can tell it that all processed images have unique name, I'm using this on dating site, you can tell that even images that are not cropped have new name. If not, maybe custom extension hooked on safecracker_submission_start.. never done this thou.
    – Davor Peic
    Jul 5, 2013 at 12:36
  • Do you know if CE Image does the image processing on the fly? Meaning, say you use {exp:ce_img:single src="/images/example/cow.jpg" max="100" crop="yes"} -- when will that image be created? When the page is viewed? Will it recreate it if the page is viewed again? It doesn't seem to me that it's optimal to do it that way. Jul 5, 2013 at 21:28
  • Also, what exactly do you to make the filenames randomize? Jul 6, 2013 at 0:37
  • All images are cached if you asking that, if the image already exist it wil use it, if its updated it will create a new one. you are creating thumbs/images using parameter hash_filename="yes" which will create image called something like this 713685002abfff67fa5972c959739477922dedca.jpg, you can also 'rewrite' path, and avoid using original upload path. In my opinion this is a very optimal, byt maybe you have some other needs besides this.
    – Davor Peic
    Jul 6, 2013 at 1:08
  • @DavorPeic, can you put your comment as an answer? I went with CE Image. Thanks. Jul 12, 2013 at 21:17

2 Answers 2

1

Assets and Channel Images both automatically prevent file-name collisions on upload, and both are Safecracker compatible.

For privacy, you can obfuscate the name (and even make it time-sensitive) using Channel Images' Locked URL tags (only for files in Channel Images), or using the Link Vault plugin (for any file, anywhere).

2

Photo Frame does this, and much much more. You can define any filename format you want. It works within Safecracker and is compatible with Matrix and Assets.

Sample Filename Format:

{random_string}-{height}-{width}.{extension}

So this would generate a file called, "s2f4leQs-450-250.png"

https://objectivehtml.com/photo-frame

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.