New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG images passed to UploadField given class of File #4469
Comments
I don't think this is a bug - images are files, but files are not images. You've defined that you want a file, and a file has been uploaded 😉 |
I realise that :) but in this case the file is an image so it should be detected and treated as such. If you upload an image through the Files interface it is recorded as an Image, so it should work the same way here. |
Oh I see, so that its consistent. Makes sense in that case 😃 |
So is it that it should be loaded as an image, but then treated as a file in the relation? Adding an |
It was never a design goal to have objects of type File referencing image files, so I would think of this as a bug. If there are different behaviours between File .jgps and Image .jpgs (e.g. how they get inserted in the WYSIWYG editor) I would expect those differences to confuse the hell out of most users. ;-) |
The problem here is that the Upload process and the Relationship setting should be two separate processes. The Upload should happen first, and if it's an image, an Image record should be added to the DB. Then the ID of the File (which just happens to be an Image) should be saved to the relation. The fact the we're saving in to a File relationship here shouldn't affect how an uploaded file is treated when it's added to the database. |
Thanks @sminnee yes it definitely makes for a poor user experience ;) I'm surprised it hasn't been noticed before actually! |
Weirdly, the image is still available to select for inserting in a HTMLEditorField, though thumbnails and Width and Height fields are missing. Once you've inserted an image though if you try to save the page you get a 500 error I thought for sure that GridField instance would only be showing Image objects as other files with ClassName=File are not shown... maybe it's doing some inefficient filtering on file extension or something? I'm sure something can be improved there and incidentally also note that the original file is displayed in the editing interface - that could be a 5mb download! In the Files section that image is a |
Closing as I have tested and confirmed this is fixed in SS 4.x |
If you have a File relation on a DataObject and upload an image to it through UploadField, the file is incorrectly recorded as a File in the database rather than an Image. This is present in 3.1 and master, probably 3.0 too.
To reproduce:
The text was updated successfully, but these errors were encountered: