Image rotation
Image rotation
Can we do something like this:
https://www.phpbb.com/community/viewtopic.php?f=72&t=2171923
to stop things like this:
http://stardot.org.uk/forums/viewtopic.php?f=41&t=5594&p=188579#p188579
Paul
https://www.phpbb.com/community/viewtopic.php?f=72&t=2171923
to stop things like this:
http://stardot.org.uk/forums/viewtopic.php?f=41&t=5594&p=188579#p188579
Paul
- 1024MAK
- Posts: 7196
- Joined: Mon Apr 18, 2011 4:46 pm
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: Image rotation
Or you can just use your iPhone/iPad or other "smart" device the "correct way up"
When in "landscape" mode, with the iPad mini (that I normally use) this means with the volume buttons on the uppermost edge.
I normally edit the photos I take on mine using the photo editor app (App Store link).
Mark

When in "landscape" mode, with the iPad mini (that I normally use) this means with the volume buttons on the uppermost edge.
I normally edit the photos I take on mine using the photo editor app (App Store link).
Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki - for answers to many questions...
BeebWiki - for answers to many questions...
Re: Image rotation
Thanks. It's not an Apple product, it's a Samsung Galaxy S8. I did take the photo in what I thought appeared to be the correct phone orientation but it seems that's the forum thinks that's not the case 
Paul

Paul
- 1024MAK
- Posts: 7196
- Joined: Mon Apr 18, 2011 4:46 pm
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: Image rotation
This problem has existed for rather a long time.
I don't have a Galaxy S8, so can only suggest you take four test photos (each with a different orientation) and post them to the forum and see what happens. Note that on Apple devices (and it may well apply to other devices) you also need to ensure that the on screen controls are the correct way up when you take the photo, as if this is not done, it can also cause issues.
I do recommend some kind of decent image/photo editor though. These (should) have a rotation function so that you can set the correct rotation yourself (rather than relying on the device "guessing" the correct rotation). You can then crop part of the sides off if not needed. It is also helpful if the app can also resize an image, or you maybe able to use a separate app. This then reduces the need for ever expanding resources needed to store large image files.
Note that at least on the Apple iPhone/iPad, in the past I found that the built in Apple image editing does not store the edited image separately where the forum/browser can get at them, so you can edit away, but the original photo/image is what gets uploaded.
Mark
I don't have a Galaxy S8, so can only suggest you take four test photos (each with a different orientation) and post them to the forum and see what happens. Note that on Apple devices (and it may well apply to other devices) you also need to ensure that the on screen controls are the correct way up when you take the photo, as if this is not done, it can also cause issues.
I do recommend some kind of decent image/photo editor though. These (should) have a rotation function so that you can set the correct rotation yourself (rather than relying on the device "guessing" the correct rotation). You can then crop part of the sides off if not needed. It is also helpful if the app can also resize an image, or you maybe able to use a separate app. This then reduces the need for ever expanding resources needed to store large image files.
Note that at least on the Apple iPhone/iPad, in the past I found that the built in Apple image editing does not store the edited image separately where the forum/browser can get at them, so you can edit away, but the original photo/image is what gets uploaded.
Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki - for answers to many questions...
BeebWiki - for answers to many questions...
Re: Image rotation
What's odd is that when phpBB serves the image directly, the browser auto-rotates the image to the correct orientation (latest Chrome on Windows 10) so the browser is capable of orienting the image correctly...
However, the browsers don't yet honour the CSS required to make this work....
https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation#Browser_compatibility
If they did, a simple "extra" css file that could be included in the deployment could be added to fix the issue once and for all

Paul
However, the browsers don't yet honour the CSS required to make this work....
https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation#Browser_compatibility
If they did, a simple "extra" css file that could be included in the deployment could be added to fix the issue once and for all

Paul
Re: Image rotation
Paul - on my IOS 11 iPad Air, when I look at your ‘snow’ picture as it appears in the thread, it is indeed upside down. However, if I tap (viz ‘click’) on it to see the full-size image, it is then the right way up! This is true for Safari, Chrome or Puffin.
That doesn’t sound as simple as having one’s picture capture device the right way up does it.....?
That doesn’t sound as simple as having one’s picture capture device the right way up does it.....?

- CMcDougall
- Posts: 5991
- Joined: Wed Feb 02, 2005 3:13 pm
- Location: Shadow in a Valley of Scotland
- Contact:
Re: Image rotation
upside down on forum, click on image to make larger, right way up!
using Win10 (new update yesterday Fall Creators) with Firefox Quantum 57.0.2
using Win10 (new update yesterday Fall Creators) with Firefox Quantum 57.0.2


- 1024MAK
- Posts: 7196
- Joined: Mon Apr 18, 2011 4:46 pm
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: Image rotation
Keep in mind that what gets displayed depends on if and how the viewer reads the metadata. Modern browsers when directly loading an image file (that is, not a embedded thumbnail), do read the metadata. If you have limited bandwidth internet connection, and try and load a large picture that has an orientation different from normal, you can sometimes see it build up from the sides or the bottom rather than from the top...
The real problem is that the source devices are "dumbed down" and automate many things so that users can just "point and click". So they don't tell the user what the actual orientation of the image is... And of course, the so called "smart" phone (or pad etc) has no real way to tell which way is up other than what it's sensors say. So if a user is holding the device "the wrong way up" or at an angle, it may well guess incorrectly compared to what a human thinks is the correct way up.
Mark
The real problem is that the source devices are "dumbed down" and automate many things so that users can just "point and click". So they don't tell the user what the actual orientation of the image is... And of course, the so called "smart" phone (or pad etc) has no real way to tell which way is up other than what it's sensors say. So if a user is holding the device "the wrong way up" or at an angle, it may well guess incorrectly compared to what a human thinks is the correct way up.
Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki - for answers to many questions...
BeebWiki - for answers to many questions...
Re: Image rotation
I realise the forum software hasn't been updated for a bit, but one of the reasons it wasn't updated for ages (and we got hacked) was because it's hard to do with lots of custom code bodged in. The main aim here is keeping things as vanilla as possible to ease updating (and also because in truth none of us have that much time to spend on anything other than contributing random comments and keeping things ticking over!). Will look in a bit more detail later. 
d.

d.
Re: Image rotation
There's a simple extension at https://phpbb-extensions.ga/extensions/ ... tator.html that should do the job.
Is it maybe left-handed people that use their phone the other way around?
Is it maybe left-handed people that use their phone the other way around?
- Nigel
BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.
BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.
Re: Image rotation
danielj wrote:I realise the forum software hasn't been updated for a bit, but one of the reasons it wasn't updated for ages (and we got hacked) was because it's hard to do with lots of custom code bodged in. The main aim here is keeping things as vanilla as possible to ease updating (and also because in truth none of us have that much time to spend on anything other than contributing random comments and keeping things ticking over!). Will look in a bit more detail later.
d.
That's why the CSS option would be so good if the browsers supported it. No material change to the install of the software, no plugins to manage, just a custom css file that would need including into the theme.
Does phpBB afford that luxury? If so, it's a solution that's worth keeping in mind for the future...
Paul
Re: Image rotation
The forum creates a new 'small' version of the file to create a "thumbnail". This is a _lot_ smaller than the original file and makes downloads quicker, reduces network bandwidth, etc.
The problem is simply one of the "thumbnail" processing not reading the original EXIF data and creating the thumbnail wrong.
If you look at paulv's original "large" image we can see it has additional metadata:
This tells any process that is reading the image that the image is upside down and needs to be rotated to get the correct orientation.
However, the thumbnail image doesn't have any orientation data at all:
EXIF data shows a lot more interesting stuff (eg the GPS co-ordinates, camera name, etc). None of this is in the thumbnail.
This tells us that the image is correct and follows the specs, but the forum software is not obeying it properly it when creating the thumbnail.
What surprises me is why phpBB team never fixed this; it's all over the place (if you google "phpbb image thumbnail orientation" you'll get tonnes of responses).
Until phpBB fixes this and our wonderful admins upgrade, I think we just need to live with it. Either ensure your pictures are always in "orientation 0" (which doesn't always work well for some pictures) or accept that people will need to click through to the full version to see it properly.
Code: Select all
% ls -l small.jpg large.jpg
-rw-r--r-- 1 sweh sweh 3729677 Dec 31 20:14 large.jpg
-rw-r--r-- 1 sweh sweh 30871 Dec 31 20:14 small.jpg
The problem is simply one of the "thumbnail" processing not reading the original EXIF data and creating the thumbnail wrong.
If you look at paulv's original "large" image we can see it has additional metadata:
Code: Select all
% exiftool large.jpg | grep -i orient
Orientation : Rotate 180
%
This tells any process that is reading the image that the image is upside down and needs to be rotated to get the correct orientation.
However, the thumbnail image doesn't have any orientation data at all:
Code: Select all
% exiftool small.jpg | grep -i orient
%
EXIF data shows a lot more interesting stuff (eg the GPS co-ordinates, camera name, etc). None of this is in the thumbnail.
Code: Select all
% exiftool large.jpg
ExifTool Version Number : 10.55
File Name : large.jpg
Directory : .
File Size : 3.6 MB
File Modification Date/Time : 2017:12:31 20:14:57-05:00
File Access Date/Time : 2017:12:31 20:15:43-05:00
File Inode Change Date/Time : 2017:12:31 20:14:57-05:00
File Permissions : rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Make : samsung
Camera Model Name : SM-G950F
Orientation : Rotate 180
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : G950FXXU1AQJ5
Modify Date : 2017:12:10 10:08:47
Y Cb Cr Positioning : Centered
Exposure Time : 1/466
F Number : 1.7
Exposure Program : Program AE
ISO : 40
Exif Version : 0220
Date/Time Original : 2017:12:10 10:08:47
Create Date : 2017:12:10 10:08:47
Components Configuration : Y, Cb, Cr, -
Shutter Speed Value : 1/468
Aperture Value : 1.7
Brightness Value : 6.67
Exposure Compensation : 0
Max Aperture Value : 1.7
Metering Mode : Multi-segment
Flash : No Flash
Focal Length : 4.2 mm
User Comment :
Sub Sec Time : 0390
Sub Sec Time Original : 0390
Sub Sec Time Digitized : 0390
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 4032
Exif Image Height : 3024
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
Exposure Mode : Auto
White Balance : Auto
Focal Length In 35mm Format : 26 mm
Scene Capture Type : Standard
Image Unique ID : F12LLJA00VM F12LLKG01GM.
GPS Version ID : 2.2.0.0
GPS Latitude Ref : North
GPS Longitude Ref : West
GPS Altitude Ref : Below Sea Level
GPS Time Stamp : 10:08:25
GPS Date Stamp : 2017:12:10
Compression : JPEG (old-style)
Thumbnail Offset : 1230
Thumbnail Length : 18246
Image Width : 4032
Image Height : 3024
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Time Stamp : 2017:12:10 05:08:47-05:00
Aperture : 1.7
GPS Altitude : 0 m Above Sea Level
GPS Date/Time : 2017:12:10 10:08:25Z
GPS Latitude : 52 deg 32' 38.00" N
GPS Longitude : 1 deg 23' 1.00" W
GPS Position : 52 deg 32' 38.00" N, 1 deg 23' 1.00" W
Image Size : 4032x3024
Megapixels : 12.2
Scale Factor To 35 mm Equivalent: 6.2
Shutter Speed : 1/466
Create Date : 2017:12:10 10:08:47.0390
Date/Time Original : 2017:12:10 10:08:47.0390
Modify Date : 2017:12:10 10:08:47.0390
Thumbnail Image : (Binary data 18246 bytes, use -b option to extract)
Circle Of Confusion : 0.005 mm
Field Of View : 69.4 deg
Focal Length : 4.2 mm (35 mm equivalent: 26.0 mm)
Hyperfocal Distance : 2.14 m
Light Value : 11.7
% exiftool small.jpg
ExifTool Version Number : 10.55
File Name : small.jpg
Directory : .
File Size : 30 kB
File Modification Date/Time : 2017:12:31 20:14:38-05:00
File Access Date/Time : 2017:12:31 20:15:20-05:00
File Inode Change Date/Time : 2017:12:31 20:15:18-05:00
File Permissions : rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Resolution Unit : None
X Resolution : 1
Y Resolution : 1
Comment : CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 90.
Image Width : 400
Image Height : 300
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 400x300
Megapixels : 0.120
This tells us that the image is correct and follows the specs, but the forum software is not obeying it properly it when creating the thumbnail.
What surprises me is why phpBB team never fixed this; it's all over the place (if you google "phpbb image thumbnail orientation" you'll get tonnes of responses).
Until phpBB fixes this and our wonderful admins upgrade, I think we just need to live with it. Either ensure your pictures are always in "orientation 0" (which doesn't always work well for some pictures) or accept that people will need to click through to the full version to see it properly.
Rgds
Stephen
Stephen
Re: Image rotation
I always check which way up the picture is displayed first before uploading to the image host website ...



Re: Image rotation
sweh wrote:What surprises me is why phpBB team never fixed this; it's all over the place (if you google "phpbb image thumbnail orientation" you'll get tonnes of responses).
Until phpBB fixes this and our wonderful admins upgrade, I think we just need to live with it. Either ensure your pictures are always in "orientation 0" (which doesn't always work well for some pictures) or accept that people will need to click through to the full version to see it properly.
How does phpBB process images? If it's feeding them to something like ImageMagick it ought to be an easy fix to just pass it the appropriate argument to tell it to auto orient the image when producing the thumnail.
A web based teletext editor which can export as Mode 7 screen memory: https://zxnet.co.uk/teletext/editor
Re: Image rotation
guesser wrote:How does phpBB process images? If it's feeding them to something like ImageMagick it ought to be an easy fix to just pass it the appropriate argument to tell it to auto orient the image when producing the thumnail.
It can use a variety of options; most common are ImageMagick or the PHP GD libraries. It may be this flexibility that's causing issues (eg php GD doesn't deal with EXIF at all unless the php EXIF libraries are also loaded).
There are unofficial patches and plugins out there, but (as previously mentioned by admins) installing these make upgrades a lot more difficult.
Rgds
Stephen
Stephen
Re: Image rotation
sweh wrote:There are unofficial patches and plugins out there, but (as previously mentioned by admins) installing these make upgrades a lot more difficult.
Since we're on phpBB 3.1.x we don't use plugins that patch code anymore. We now have extensions that rarely affect upgrades. I linked to an extension earlier in the thread, try it. If it doesn't work then simply disable and remove, no harm done.
- Nigel
BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.
BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.
Re: Image rotation
sweh wrote:There are unofficial patches and plugins out there, but (as previously mentioned by admins) installing these make upgrades a lot more difficult.
Oh I wasn't suggesting hacking the forum about, just musing that it doesn't seem like it should be a hard problem to solve.
A web based teletext editor which can export as Mode 7 screen memory: https://zxnet.co.uk/teletext/editor
Re: Image rotation
It's only hard in that it involves diving into a relatively unfamiliar set up when it's not the day job; and despite minimal risk, the hassle involved if the forum gets broken will be quite high and require more than the 5/10 minutes at a time that any of us normally manage to grab to attempt to address these things!
It is noted, but currently more pressing is a forum software upgrade.
d.
It is noted, but currently more pressing is a forum software upgrade.

d.