Drupal 6.4
Content Construction Kit (CCK) 6.x-2.0-rc7
FileField 6.x-3.0-alpha4
FileField Paths 6.x-1.x-dev (2008-Aug-29)
ImageCache 6.x-1.0-alpha2
ImageField 6.x-3.0-alpha2
Token 6.x-1.11
Transliteration 6.x-2.0

I use FileField Paths in combination with ImageField to rename uploaded files automatically.

At first I used [nid].[filefield_paths-ext].
The uploaded image was not visible after submitting the node. The CCK Block, which shows me the link to the uploaded image, showed the link with the original file name (not the renamed file name). After re-editing the node (without any edits, I just opened "Edit" and submitted immediately) the uploaded image was named correctly and the link to it, too.

I thought, this problem would relate to the use of [nid], so I tried some different tokens. But: I got this problem with each choice. I even tried
image.foobar, because there is nothing wich had to be "dynamically" created, but the image onlys shows up after edit or after I cleared the Drupal cache.

Help please.

Comments

no2e’s picture

Please, can someone help me?

I can't go live in this state. If users upload images, noone can see them until I cleared the cache. And to cap it all it also shows the old (local) filename to the whole world, as long I cleared the cache. That's an absolute no-go. I don't want to let the world know how my users named their images.

deciphered’s picture

@no2e

Unfortunately I'm currently on holidays and have a lot on my plate as I have just moved house. However as soon as I have everything settled I will look into this issue.

no2e’s picture

Ah okay, that's understandable, of course.
Easy does it (or what you say in English ;D)

deciphered’s picture

Status: Active » Postponed (maintainer needs more info)

Hi no2e,

As the node information is not available until a node has been created the file renaming is not done until you hit the 'Save' button.
This means that what you described in your initial post is the expected behavior, the user will upload the file, the file will be stored with it's original filename, the user will save the node and the file will be renamed.

What I don't understand is your second message, that the user can't see the files until you clear the cache. I can't replicate this issue myself, so if you could please elaborate and I will do my best to resolve this issue for you.

Cheers,
Deciphered.

no2e’s picture

This means that what you described in your initial post is the expected behavior, the user will upload the file, the file will be stored with it's original filename, the user will save the node and the file will be renamed.

So, do you mean, that the image should be visible after submitting the node? Sorry, don't quite get it.
I state the way I create a new image node:

Procedure:

  1. I set the "File name" setting for the CCK ImageField to: example.test (so there's no placeholder token used)
  2. I upload an image
  3. The preview thumbnail is shown (with original file name)
  4. I save the node
  5. No image is visible
    • The img-element in the source code tries to load the image with it's original name
  6. I edit the node
  7. The preview thumbnail is shown (now with renamed file name: example.test.thumb.jpg)
  8. I save the node (without any edits)
  9. The image is visible (example.test)

Instead of re-editing the node (step 6) I could clear the Drupal cache. After that the image is visible, too.
And this behaviour is the same for whatever tokens I tried.

deciphered’s picture

Yes, the image should be showing, If you looked at the file system after you save the node the file should be renamed.

What are you using to display the image on the node? Is it being displayed via ImageCache or something similar?

Is your development server accessible?

no2e’s picture

What are you using to display the image on the node? Is it being displayed via ImageCache or something similar?

Yes, I have an ImageCache preset for the image shown in a node.
After submitting the node for the first time, the image URL of the source code shows the correct path for the ImageCache preset, but the wrong file name:
http://example.com/sites/default/files/imagecache/sshot_node/screenshots/screenshot-foobar.jpg

The server is not accessible.

deciphered’s picture

Status: Postponed (maintainer needs more info) » Active

It's quite possible that the ImageCache preset is what's causing the problem. I will have to look into this a bit further.

Out of curiosity, can you check the actual uploaded file (/sites/default/files/screenshots/screenshot-foobar.jpg) to see if it changes correctly after one save? Just checking via ftp or directly on your server will do. I understand that the imagecache file is wrong, but it would be nice to know if the source image is correct.

deciphered’s picture

Title: ImageField: uploaded images show up only after re-edit or cleared Drupal cache » ImageCache gets unprocessed filename.

Confirmed bug with ImageCache integration.

no2e’s picture

Title: ImageCache gets unprocessed filename. » ImageField: uploaded images show up only after re-edit or cleared Drupal cache

Uhrm, it's weird.

I didn't see the uploaded image anywhere in my FTP account. I checked all subfolders of /default/files, but there was no currently uploaded image. So I cleared the Drupal cache. After that, I could see the image in Drupal itself under http://example.com/sites/default/files/imagecache/sshot_node/screenshots/47.jpg but in this folder at my FTP, there is no image named 47.jpg. Weird. Even after logging out and in again, still: no image in FTP, but it's accessible in Drupal...

But I can see the images which I uploaded before (e.g. example.test), although I deleted the nodes.

I test some more, now. Don't understand anything at the moment -.-

no2e’s picture

Title: ImageField: uploaded images show up only after re-edit or cleared Drupal cache » ImageCache gets unprocessed filename.

(title overwritten)

no2e’s picture

Deciphered:

Confirmed bug with ImageCache integration.

Are you trying to fix it, or is it an ImageCache issue?

deciphered’s picture

Yes, I am looking into fixing the issue.

I will post more when I have more, but the issue is not as simple as I first thought.

ipto’s picture

Deciphered Thank you for your very useful module

imagecache-6.x-2.0-beta1
imageapi-6.x-1.0
cck-6.x-2.0-rc10
filefield-6.x-3.0-alpha5
filefield_paths-6.x-1.x-dev
magefield-6.x-3.0-alpha2

Work fine, have't problem with filenames isung imagecache. But before (with other versions of plug-ins) was indeed a problem.

no2e’s picture

It works for me, too.
Just updated the modules to the same versions as ipto did. I uploaded an image and I can see imagecache and original versions immediately.

deciphered’s picture

Status: Active » Closed (fixed)

Thanks for the update guys, I can confirm that the latest version of ImageCache has fixed this issue.