I try to create an image gallery.
Filenames
I want users to upload images, but the local filenames of the images shall not be adopted by Drupal.
Drupal shall name the files automatically (in whatever way, cryptic, number and letter combinations or something like that, or counting from 1 to XYZ etc. it doesn't matter - although it would be cool, if the filenames would have all the same length!)
Page url
I created a pathauto URL alias like example.org/gallery/[nid] with the help of the module "Automatic nodetitles". But: the node id is no good solution for it, because
- other content types use the node id, too. So the urls of my gallery are not consistent (like gallery/1, /2, /3 ...) but maybe /7, /8, /13 - where 9 - 12 are node id's of other content types.
- the node id is not always of the same length: /1 ... /11 ... /111 etc.
All the filenames should have the same length (like at youtube.com, where each videos url is 11 characters long and consists of letters and numbers).
And I want the user to optionally enter a title manually. But in both cases (the user did enter a title or he did not), the automatic named URL shall be used and not the users title. If I understood the module right, it does not name nodes automatic, if the user entered a title.
Comments
Try Pathauto
hi,
You can try http://drupal.org/project/pathauto module.
May be helpful to you.
Thanks,
@kuldip zala:
As mentioned above, I'm currently using pathauto. But I can't use it for filenames, can I?
And about the page url's: I use pathauto in combination with Automatic nodetitles, but exactly that is my cause here ;) How's it possible, to create unique urls of the same length automatically?
----
current requests: multi-site | OpenID | (template) editor inside drupal
Correct
Correct. Pathauto works with nodes, not files you upload to the site.
"Nice to meet you Rose...run for your life." - The Doctor
Use PHP to name images
I'm not familiar with the usage of the modules in question. So this may be an invalid suggestion:
The description of automatic node titles says: "Advanced users can also provide some PHP code, that is used for automatically generating an appropriate title."
Perhaps you can insert some code that aliasies images with eg. IMG0001 IMG0002 etc. as desired while aliasing with a normal counter for other kinds of content.
Possible with PHP?
Well, if this is possible with PHP, it would be fine. Unfortunately I don't "speak" PHP :|
----
current: multi-site | OpenID | online editor
Hard way
A really hard but possible way would be to be notified every time a user uploaded an image (using triggers and actions) and then manually alias the image in a way you see fit.
The php option seems the cleanest though. See if you can get any help from anyone.
What I meant was...
*Manually* rename the title every time to ImageXXXX or whatever you want every time.
You can get notified every time a particular type of content is created through actions
other content types use the
I think this is not true. For what I know, NIDs are unique and not reused (i.e. if you delete a node, its nid is not reused)
Ciao,
GP
I think this is not true.
Yes, they are unique. But all Content Types share the same enumeration. So the first node is 1, the second 2, and so on - no matter what Content Type is used (because they are all Nodes). So with [nid] the URL of my image Content Type could look like ../2, ../17, ../19 and when users type in ../3 they get a 404 respectively an node of an other Content Type.
----
current: multi-site | OpenID | online editor | Automatic filenames
If you need consistent sizes
If you need consistent sizes you may use a unix timestamp, but the patterns available do not include that, only year, week, month and days.
Do you need the images to be renamed or just the image paths?
http://inTribu.com
Do you need the images to
Hmmm ... well, I'd like to have the files renamed, because I want to offer them all together to download.
----
current: multi-site | OpenID | online editor | Automatic filenames
If you need consistent
Which patterns do you mean: automatic nodetitle's (for nodes), or for files (images)?
At this point, I'd choose every method to rename files automatically at upload, no matter to what. I just don't want the files to be named like what the user named them on his local machine. Please, anyone?
It seems that Uploadpath has, what I want:
"It can also allow you to automatically rename uploaded files based on file description or node title."
But can I use it with CCK / ImageField? I don't think so ...
Uploadpath just might work
From the description:
I think Imagefield uses the upload module. If that is truly the case the file should be renamed. Check it out and tell us if it works...
The patterns in the pathauto
The patterns in the pathauto don't have time, only days and years.
I like the option of creating a hook for the file upload, there you can rename the files.
I have not seen any available module that will do what you want.
http://inTribu.com
Got a solution - maybe
Currently I use filefield_paths.
If I got this issue solved, it does exactly, what I need:
I can create "patterns" with tokens (similar to pathauto), that rename the uploaded (via ImageField) images.
But as stated in the issue, currently the image won't shop up, until I re-edit the node or clear the Drupal cache :(