Bug in image thumbnailing code with linked, rotated images

mpsmyth

Joined: 2006-06-18
Posts: 9
Posted: Tue, 2006-06-20 04:55

I ran into an issue that my image thumbnails would not rotate after being linked from another album and then rotated, which I asked for help with on the troubleshooting forum. I worked it through, and it appears it's an actual bug. Reproducible every time. I ended up looking at the pictures whose thumbnails were working and found that in every instance that was working, the pictures were rotated in my original album. I then set up a test, uploading a picture to a test album and two other locations, and set up the possible conditions:
Picture linked from other album, then rotated in target (test) album. Failure.
Picture uploaded into (test) album, rotated. Success.
Picture rotated in original album, then linked to target (test) album. Success.

It appears (from black-box QA only) the thumbnail generation code in a linked image actually goes back to the initial image to get the data and ignores any local (rotated) copy... which would be the right answer if there was no local copy, but you have to test for that condition first. I don't know PHP so here's pseudocode to illustrate:

image GenerateThumbnail(item itemToThumb, size thumbDimensions) {
  if (itemToThumb.IsLink()) {
    if (itemToThumb.HasLocalVersion()) {
      return ScaleImage(itemToThumb.LocalVersionImageData, thumbDimensions);
    } else {
      return ScaleImage(itemToThumb.linkTargetImageData, thumbDimensions);
    }
  } else {
    return ScaleImage(itemToThumb.imageData, thumbDimensions);
  }
}

Is there anyone who knows the image thumbnailing code and could try and patch it, or if there is somewhere else I should report a bug? I'm happy to be a guinea pig for the test code...