-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
OC_Image doesn't always set imageType correctly #18645
Comments
Do you want to open a pull request? |
I don't fully understand how everything in OC_Image works together and there seem to be some more issues to get fixOrientation working. Commit 88db5a365b53e713fe31bcc032fc22e48a56accc sets the imagetype work loadFromData() and loadFromBase64(). It's still missing for load() if it gets passed a resource. |
@gvde The first step would be to list all the methods in image which require a proper imagetype to be set and then the best thing to do is to provide a PR so that we can test various scenarios. The unit/integration tests of Preview should give us a first indication of if there are side-effects. |
OK, quick assessment. Imagetype is only set when an image is loaded from file Affected methods:
So, it would be good to get a PR which also includes setting the imagetype for resources- |
Please try again with 9.1.4 or 10.0 beta |
Has this issue been fixed in 10.0.9.5? Reason for asking is that EXIF based image rotation is failing for all JPG images in my vanilla 10.0.9.5 installation. Relevant log file lines...
|
do you have more details about setup and reproduction steps ? see https://raw.githubusercontent.com/owncloud/core/master/.github/issue_template.md |
Steps to reproduce
$ exiftool-5.26 IMG_1928.JPG Expected behaviourThe thumbnail in the web interface as well as the preview produced by the gallery app should be rotated correctly. Actual behaviourJPG images are not rotated at all and appear upside down or rotated by 90° in either direction. I did a very rough call backtrace and see that upon thumbnail generation, Server configurationOperating system: Web server: Database: PHP version: ownCloud version: (see ownCloud admin page) Updated from an older ownCloud or fresh install: Where did you install ownCloud from: Signing status (ownCloud 9.0 and above): Technical informationThe following list covers which files have failed the integrity check. Please read Results
Raw outputArray
) The content of config/config.php: { List of activated apps: `
Are you using external storage, if yes which one: local/smb/sftp/... Are you using encryption: yes/no Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... Client configurationBrowser: Operating system: Logs
|
Confirmed. As for gallery, it's strange because someone worked on rotation in recent versions owncloud/gallery#764 and was reported working. I wonder what changed since. |
this is a pure client side (in browser) feature - this has no influence on the thumbnail generation |
Works fine in 10.0.8, broken in 10.0.9. Regression introduced through one of these: from the thumbnail related rework in #31050. The code path in question leads to https://github.com/owncloud/core/blob/v10.0.9/lib/private/Preview/Image.php#L49 which does not pass image type. Might need to pre-detect based on extension ? |
seems side note: seems this stores the full picture in memory ?? |
I had a local try setting imageType, now it says |
any chance that this will be fixed soon? |
We're going to address various preview issues as part of this project https://github.com/owncloud/files_mediaviewer. Due to the current workload probably not until beginning next year or so (10.1.1) |
Sorry, but I dont get this. |
@gramels we're a small team and we currently have other priorities so we cannot start working on this right away. Fixing this is definitely planned, together with other fixes to improve the preview system in general. I agree that it is unfortunate that a regression is taking that long to fix. There were changes that needed to be made in the preview system (related to object store support with versioning) so fixing this will not be trivial and might require bigger changes in the preview system. I do hope that said changes will be for the best. Also note that this is open-source so anyone else can also help fixing this. |
So is the message by the owncloud team to owncloud users not to use the gallery? Did anybody experience the same issue with nextcloud? |
migrated to nextcloud |
I have the same issue. @PVince81 : Any details when it will b e fixed? |
AnalysisI tried to figure out that there is something wrong with https://github.com/owncloud/core/blob/master/lib/private/legacy/image.php#L386, which is causing the rotation of the image shared #18645 (comment). I will update more regarding the same in this comment. Since this analysis is in the initial stage, the more information found would lead us to the actual problem. Found a method I have also noticed #29319, which replaced Using objectstoreUsing gallery to verify the preview with The preview from object store version preview for the image file PRCreated PR: #34297
PS: The idea behind public link preview and trashbin preview is inspired from comment : #29319 (review) |
@sharidas please also test with external storage and make sure the file is not downloaded to temp space when on local storage. With ext storage, |
@sharidas also verify version preview: open versions panel and see the thumbnail orientation |
While testing with external storage SFTP, I have noticed that
So I believe it is not downloaded to the tmp location. Let me know if we agree with this observation. |
Regarding preview for version, I am missing bits how to get the version update for image :( I mean after uploading the file, may I know how to update the image so that version panel lists previous version? Regarding preview for text file the version panel, it is working properly Regarding preview for image, the version panel is as shown here |
@sharidas depending on your distro the tmp files might be in chroot somewhere in /tmp. try searching for the exact file name. you'll likely need to set a breakpoint to prevent the file getting deleted |
Analysis with external storageScenario by having SFTP as externa storage
@PVince81 I assume this is what you wanted me to look at from #18645 (comment) and #18645 (comment) |
fix will be in 10.1.1 (10.1.0 already is in code freeze) |
The fix doesn't seem to be in 10.1.1: https://github.com/owncloud/core/blob/v10.1.1/lib/private/Preview/Image.php |
Predicting the specific number of a future version is a risky undertaking ;) The fix for the issue here was backported to |
Thank you for the explanation :) , it's very helpful. I mainly wanted to save other readers here the hassle of having to find this out the hard way. And I wanted to verify that this patch is indeed coming to a release. |
you can already test with the RC1 if you like: https://central.owncloud.org/t/owncloud-server-10-2-0-rc1-released/19499 |
OC_Image has imageType = IMAGETYPE_PNG by default.
Several load functions like loadFromBase64, loadFromData, loadFromFileHandle, load don't (always) set imageType to the correct type of image loaded.
For example, if you load a JPEG with loadFromData() imageType remains on IMAGETYPE_PNG.
Due to this, some other image processing functions don't correctly work or cause errors.
For example you get error "OC_Image->fixOrientation() Image is not a JPEG" if you call fixOrientation() on a JPEG loaded with loadFromData even though it's in fact a JPEG.
imageType should always match the type of image. All functions seems to set mimeType correctly but lack to set imageType...
The text was updated successfully, but these errors were encountered: