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?

CommentFileSizeAuthor
#1 image_test_filename.patch1 KBjoachim

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1 KB

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

sun’s picture

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.

joachim’s picture

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?

Leeteq’s picture

Subscribing.

joachim’s picture

Status: Needs work » Postponed

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

joachim’s picture

Status: Postponed » Closed (works as designed)
sp3boy’s picture

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.

sp3boy’s picture

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.