Reputation: 13537
Is there any way to make the "image" module store files under a new name on upload? Basically, someone could upload a file that says something like "macs are cool" or something equally absurd. Now, I don't want people to see that. I'd much rather have all the files renamed on upload to something like: "111494949478383.jpg". How would I go about accomplishing this?
Upvotes: 1
Views: 4738
Reputation: 21
You can use the module "filefield Paths", and put in the filename [raw] that way the uploaded picture will have the node's timestamp creation time.
Also you can use [raw]_[filename].[file-extension] or whatever combination you can use, take a look at "file name replacement patterns"
Upvotes: 2
Reputation: 3388
The FileField Paths module should do what you want. It works with both core Upload, as well as the FileField and Imagefield modules. You may also want to check out Imagefield Tokens, which allows the use of node tokens in things like the default alt text for images.
Upvotes: 4
Reputation: 12187
with hook_nodeapi you could move the files and rename the images when the node is saved.
Or you could add something to the image upload callback with hook form alter to rename the image once it has been uploaded
Upvotes: 1
Reputation:
there are file modules that basically use tokens to do this
edit also imagefield supports tokens http://drupal.org/node/152640 immagefield could be better in long run if cck going to Drupal 7
hope that helps
Upvotes: 0