I have PDF to ImageField working OK, except for the generated image filename.

  1. Filefield is set-up to upload PDFs into a directory "newsletter", and the generated file looks like "2012-newsletter-23.pdf", and works perfectly
  2. However, the generated image (a) is stored in /files and not "newsletter", and (b) the generated filename is "9-0.jpg" (or similar, ie. 14-0.jpg).

I'd like the generated image stored in files/directory, and the generated image filename to match the PDF filename.

Any thoughts?

Comments

dman’s picture

The intended behavior is that the file filed directory settings for the image field should be used. You can set both the pdf input folder and the generated jpeg output folder to be the same if that's what you intend.
If that's not working, it's a bit of a bug.

I can't recall the rules for the generated filename, but I would have expected it to be based on the pdf filename also. Not sure why that would be failing.

iantresman’s picture

I think I'm setting the paths correctly. I'm using:

For the uploaded PDF file (this works fine):

  • FileField Path settings | File path: newsletter
  • FileField Path settings | File name: [field_issuedate-yyyy]-newsletter-[field_issue-formatted].pdf

For the destination imagefield

  • I've tried leaving the FileField Path settings blank (assuming they would be inherited)
  • Setting the FileField Path settings as for the PDF (except for the image suffix, set to JPG).

Note added: I'm using a multi-site set-up, with a single Drupal codebase, and each website is in sites/<domain>/files

iantresman’s picture

Category: feature » bug

It seems that no matter what I enter in the Imagefield File name field, the generated filename is always of the format 18-0.jpg, 19-0.jpg, 20-0.jpg, etc (ie. the first number increments by one each time). I thought the number might be the nid, but it is not.

I also tried changing the order of the Imagefield CCK fields, to no affect.

So it seems that it may indeed be a bug.

foko’s picture

Hi there. Somebody got any solution for that issue? I got the same problem right now..
And i just need the generated Jpeg to get the same filename like the uploaded PDF-file.

Hope somebody knows the secret.. Thanks! :)

jamesrutherford’s picture

Confirming this is a bug. Drupal 6.25 cck 3 PDF to imagefield 6.x-2.0+7-dev. Neither the imagefield or the filefield use the name and path settings I specified.

dman’s picture

Yeah. The 7.x-2.x changed the internal structure to use its own version of a file field instead of inheriting and extending the core one. This means that a lot of utilities that hang off file field (like filefield_paths) were incompatible with it.
This looks unsustainable, and I'd rather have some form of token support and compatibility with other modules going on, so I'm trying to fix that back to like it was in D6.

It's happening in a new branch

iantresman’s picture

Many thanks, looking forward to a new 6.x-2.x-dev version to try out.

iantresman’s picture

Just wondering whether we are any closer to a fix or workaround

dman’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Closing 6.x issues as unsupported. (sorry?)