Download & Extend

images saved to files table with bad data in filename column

Project:Image
Version:6.x-1.x-dev
Component:image.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:postponed

Issue Summary

Found this while making a file view...

File ID  Name  Path  Image size
45  thumbnail                         sites/default/files/images/test-filename-in-table.thumbnail.jpg  Thumbnail
44 _original                                sites/default/files/images/test-filename-in-table.jpg Original
43 test-filename-in-table.jpg       sites/default/files/images/temp/test-filename-in-table.jpg
36 bird wallpaper.jpg                D:\xampp\tmp/bird wallpaper_7.jpg
37 bird wallpaper.jpg                sites/default/files/bird wallpaper.jpg
38 Accountancy Shanty.m4a      sites/default/files/Accountancy Shanty.m4a

The last file was uploaded with upload.module for comparison.
Surely this isn't right?
According to the schema for the files table, filename is 'Name of the file.' Somehow we're getting the just the size in there -- perhaps because it's everything after the dot?

Comments

#1

Status:active» needs review

Here's a patch that adds a test for this.
Obviously, it currently FAILS.

AttachmentSizeStatusTest resultOperations
image_test_filename.patch1 KBIgnored: Check issue status.NoneNone

#2

Status:needs review» needs work

AFAIK, we always stored the image preset size name there - because we store the title and other stuff for the image in the image node.

#3

Found this: http://drupal.org/node/33482
In comment #2 walkah writes:

"i love the "domain" idea ... i.e. image.module can use it to keep track of "image_thumbnail" ... etc. (rather than the file name hack now)."

So it's a hack :)
Is it still needed on D6?

#4

Subscribing.

#5

Status:needs work» postponed

Let's postpone this...
or even, is it by design?

#6

Status:postponed» closed (works as designed)

#7

Status:closed (works as designed)» active

Just came across this issue while continuing my testing of the achievable integration between Filefield_paths and Image (see #564680: Add support for bulk rebuilds of derivative files in Image module, #564690: Improve support for Filefield_paths to tokenise image filename and path and for good measure #422798: unexpected results when using [termpath] and [termpath-raw] tokens in other modules) .

When Filefield_paths is installed, it creates the "origname" column in {files} and populates it from the "filename" column of that same table. In the context of Filefield_paths, having the image size in the "origname" column (because it was written to {files}.filename in _image_insert()) does not seem sensible.

I support a move to make the {files}.filename column hold the name of the file that Image module creates on the server at the time of upload / import. The image size is already available on the {image}.image_size column and I have found just one piece of code that uses {files}.filename to select by size: in image_gallery.pages.inc where image_gallery_page() includes it in a "where" clause when the required sort sequence is IMAGE_GALLERY_SORT_FILENAME. However it very much looks like the {image}.image_size column could be used there instead.

I am currently looking at some unexpected behaviour from Filefield_paths whereby it does not appear to be using the {files}.origname column to re-generate a new tokenised filename, but is using whatever the current (tokenised) name is, thereby not eliminating unwanted token portions. Without a meaningful (and preferably original) filename in the {files}.origname column for images, I expect it would be very difficult for that to be achieved.

I am happy to build whatever patch is needed but I thought I'd just add my thoughts to this thread first.

#8

Status:active» postponed

This issue is now a cornerstone of #564690: Improve support for Filefield_paths to tokenise image filename and path so I'll put the status back.

nobody click here