Unusual uploaded image re-sizing

I don’t think that option was available to the Royal Botanic Garden:

Storm Éowyn: Gardens staff ‘devastated’ at loss of Edinburgh’s tallest tree - BBC News

which is also well-known for its rubbish weather obs on the BBC Weather page for Edinburgh:

RBG

compared to the obs at Gogarbank shown for other postcode areas of Edinburgh:

Gogar

Was it the tree or the Botanic Gardens that had rubbish weather obs? The screen shots are a bit too small to read.

Normally .png images can be enlarged by clicking on them. . . I’ll try again with .jpg

RBG

EDIT: only the second of these shows the description for enlargement when you hover over it :confused:

jpg and png should be handled the same way. How are you uploading the images - drag and drop, cut and paste or using the upload icon?

Using the upload icon.

It looks like RBG image is just small enough to fit on a normal page so isn’t resized. The Gogarbank image is a bit wider so is resized so has extra options.

I don’t understand that. Raw sizes, uploaded at 100%:

Gogar jpg 1172 x 103, png 1168 x 95
RBG jpg 1180 x 82, png 1177 x 92

So, in fact, the RBG images are wider than the Gogarbank ones :confused:

I think I know what’s going on, but first I have to complain that the forum software is too deviously clever!

I started experimenting by uploading the images you sent with different settings, but couldn’t get a different result to what you were finding. That seemed weird because some of the setting changes I made should have made significant differences to what I saw. Eventually I noticed that the images I was re-uploading always had the same internal image ID, but I was expecting them to get a new ID for each upload.

I figured out why…each time an image is uploaded the forum software calculates a checksum of it and if the checksum matches one for a previously uploaded image then it just uses the previous image and throws the newly uploaded image away. That’s clever be cause it avoids storing multiple copies of the same image and also reprocessing the same image multiple times, e.g. for re-sizing. However, it does make testing using the same images rather tricky!

Having got past that hurdle, I’m pretty sure I know what’s happening with your uploads and I’m classing it as a bug. This is roughly what the software does when you upload an image:

  1. Calculate the checksum and use the old file if we already know the checksum :rofl:
  2. Is the image bigger than allowed (my settings are 350 * 200)? If not, just use the image as uploaded. If yes, carry on to step 3.
  3. Resize the image to 350 * 200.
  4. If the resultant image has either dimensions equal to or bigger than 350 * 200 then put it in a lightbox. The lightbox is what gives the ability to be enlarged.

That sounds great, apart from the fact that resizing isn’t an absolutely exact science. So aiming to create a 350 * 200 file doesn’t always give you that exact size. For example, 3 of the 4 images you uploaded were resized to 349 pixels wide. So the test in step 4 failed…the image was no longer 350 * 200 or bigger, so the lightbox wasn’t added.

I’ll report this, but it might not be fixed for a while.

1 Like

Good detective work :grinning:

And in case anyone is wondering what I was pointing out, the Gogarbank obs (the one image you can enlarge) include icon, temp, wind, hum, vis, pressure and trend, while RBG has only T/H. . .

The actual Met Office station at RBG is “Royal Botanic Garden No.2”.

1 Like

I’ve reported the issue. I also found a bug that was fixed at the end of last year that probably has something to do with this. It’s a slightly different reason than I suspected but the end result is the same in that the lightbox isn’t applied due to the size one of the image dimensions.

In the dim recesses of my mind I thought I remembered a similar observation about uploading zip files for download, so I spent some time searching. . . see https://discourse.weather-watch.com/t/2024-11-29-problems-errors/74500/22

I didn’t understand it at the time, but is it possible?

That thread suggest they’re not uploaded if similar. That’s not correct. The files would need to be identical.

Whilst checksum clashes are possible, if a good checksum is used then they would be incredibly rare. It’s also highly likely that if two files had the same checksum they would probably have very different content.

With checksums a single character difference gives a very different checksum. For example, a relatively simple 32-bit checksum of two strings identical apart from one character gives…

“Hello World.” - 5A 44 9E DB
“Hello World!” - A9 82 D8 F2

1 Like