-
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
Fix imagerotate and move loadFromBase64() one up #7182
Conversation
imagerotate() with third parameter being -1 does not seem to work in PHP 5.5 loadFromBase64() one up, so debug-logs aren't spammed (as much) with urlencoded base64-data from loadFromFile() debug output.
A new inspection was created. |
This should be backported as well, imo. The same thing is happening in stable6 to me. @karlitschek |
🚀 Test Passed. 🚀 |
Not tested but looks good. |
For reference, the php5.5 rotation issue was known: owncloud-archive/apps#1555 |
I've hardly touched this class since I made it in in apparently 2011 so other reviewers are needed. |
@josh4trunks @bjalt can you help testing this ? |
I'll try it tonight. ill test with php5.5 |
Excellent. Make sure to use the "command line" instructions in the green box because checking out the branch directly won't work until this PR is rebased onto master by @Kondou-ger |
I mean do this:
I'm testing on PHP 5.4 and PHP 5.3 now to make sure it still works.
|
Tested on openSUSE 13.1 with PHP 5.4. Images are rotated correctly in the thumbnails and gallery app. 👍 Let's wait for the feedback from @josh4trunks for the PHP 5.5 case. |
The commandline instructions and even just the latest master were giving me a white screen. It might be because my setup hosts owncloud in a subdirectory (eg. http://example.com/owncloud), or because my setup uses php-fpm. I just ended up applying the commit to 6.0.2 Tested on FreeBSD 10.0 with PHP 5.5
You need me to try something else? I'll fish around for a commit on thumbnails in the 'Pictures'/Gallery app. |
php-fpm shouldn't be a problem, as I'm using that as well. |
@josh4trunks you need to run I tried again with PHP 5.4 and the pictures app rotates the thumbnails correctly, and also when viewing the pics they are rotated as well. @josh4trunks when testing, please make sure to upload new pics because the old ones might be cached unrotated already. |
@Kondou-ger awesome, must be something else I did then. |
Using the above commands to create a new development environment worked. I am getting the same behavior I earlier reported, picture rotation works in the files app's thumbnail and fullscreen view. Rotation doesn't work in the 'Gallery' app's thumbnail view. This is because the thumbnail was converted to a PNG even though the filename still ends with JPG, this has been reported here owncloud-archive/apps#1568 I vote to merge this commit, it works for PHP 5.3-5, the gallery thumbnail rotation issue is unrelated. |
@josh4trunks thumbnails are a different issue, it's the same as this: #7141 (comment) |
@Kondou-ger so you're it's an underlying issue with OCImage? Do you believe the JPG>PNG conversion is the cause (I assume the exif data is lost when converting to PNG), or do you think that is an unrelated issue? |
@Kondou-ger I just uploaded an EXIF rotated JPG as a profile picture. The resulting thumbnail is a PNG (which doesn't respect the EXIF rotation). |
Thumbnails are converted to png? Didn't even know that. Might be helpful, might not be. |
Yup, really weird, thought the filename stays JPG. But downloading the resulting file shows it's a PNG. PNGs can't have associated EXIF data so either..
|
I haven't followed this thread closely, but from what I know about GD the problem is that unless you load the image from file, you have no idea of the format. AFAIRC that's why I decided to convert output as PNG unless the format was known. In loadFromBase64, loadFromResource there's no EXIF data available, so I guess the problem lays in the original loading of the image. If it's loaded from file any EXIF data conversions most be made then if the image is to be transformed in any way, otherwise the data is lost. I think loadFromData will still have metadata, but it has to be extracted from the data at load time. |
Awesome, thanks for the clarification! So that still leaves us with the two options I mentioned earlier. @PVince81 you said thumbs (for JPGs with EXIF rotation) in the Gallery app worked for you? What happens if you upload a JPG with EXIF rotation as your profile picture? |
The first non-static class in ownCloud btw 😄 |
Awesome =] guess you can never get away from it now, lol |
Trying ;) |
I was actually testing with JPG files all the time. Since this change doesn't break anything and seems to partially fix the thumbnail rotation in PHP 5.5, my thumbs up still apply 👍 This needs another thumbs up: @josh4trunks or @tanghus ? |
I just realized that I was using already rotated pictures... seems the Nexus 4 does not only set exif info but also saves the pictures already rotated... I had another try with pics from a camera and here is the result
So, if @josh4trunks had the same results on PHP 5.5. then it is already an improvement so we can get this merged once we get the second thumbs up 😄 |
I've been for this getting merged, I just didn't know the procedure =] |
Ok, so now to figure out if we should..
Unless @tanghus has any qualms I've for 1 |
@josh4trunks thanks. Going to merge this now. Edit: fixed issue number |
Fix imagerotate and move loadFromBase64() one up
This one seems to be relevant as well: owncloud-archive/apps#1590 |
imagerotate()
with third parameter being -1 does not seem to work in PHP 5.5loadFromBase64()
one up, so debug-logs aren't spammed (as much) with urlencoded base64-data fromloadFromFile()
debug output.Not sure whether the order in
OC_Image->load()
has to be the way it is now (base64-like file-paths?), but doing some short tests didn't seem like it.