ruven / iipsrv

iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
https://iipimage.sourceforge.io
GNU General Public License v3.0
292 stars 115 forks source link

requested width and height set to 0 when either full or w, or ,h #232

Closed nicolasfranck closed 2 years ago

nicolasfranck commented 2 years ago

Commit: https://github.com/ruven/iipsrv/commit/f57b41b06ee536b6ff3aba095884107d3ffea139

Problem: if you requested something with size full or w, or ,h, you'll get an error if the region is either full or square. Size seems to be dependent on the region:

IIIF: invalid size: requested width or height < 0

It seems that the entire region array is filled with zero's. The requested_width and request_height is also set to region[2] and region[3] respectively. But there is probably more going on. I tried to play with region array, but to no avail..

My logs

Full Request is IIIF=%252FUsers%252Fnjfranck%252Fgrim-data%252Ffiles%252F2022%252F03%252F19%252F11%252F15%252F14%252Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91%252Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91_DS-1.jp2%2Ffull%2Ffull%2F0%2Fdefault.jpg
[1/1]: Command / Argument is IIIF : %252FUsers%252Fnjfranck%252Fgrim-data%252Ffiles%252F2022%252F03%252F19%252F11%252F15%252F14%252Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91%252Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91_DS-1.jp2%2Ffull%2Ffull%2F0%2Fdefault.jpg
IIIF handler reached
IIIF :: URL decoded to %2FUsers%2Fnjfranck%2Fgrim-data%2Ffiles%2F2022%2F03%2F19%2F11%2F15%2F14%2Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91%2Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91_DS-1.jp2/full/full/0/default.jpg
FIF handler reached
FIF :: URL decoding/filtering: %2FUsers%2Fnjfranck%2Fgrim-data%2Ffiles%2F2022%2F03%2F19%2F11%2F15%2F14%2Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91%2Farchive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91_DS-1.jp2 => /Users/njfranck/grim-data/files/2022/03/19/11/15/14/archive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91/archive-ugent-be-E82D4EB8-6FF9-11E1-B905-38B03B7C8C91_DS-1.jp2
FIF :: Image cache initialization
FIF :: JPEG2000 image detected
FIF :: Created image
FIF :: Image dimensions are 3934 x 8013
FIF :: Image contains 3 channels with 8 bits per channel
FIF :: Image timestamp: Sat, 19 Mar 2022 11:15:23 GMT
FIF :: Total command time 44511 microseconds
IIIF :: Requested Region: x:0, y:0, w:0, h:0
IIIF: invalid size: requested width or height < 0
Sending HTTP 400 Bad Request
Total Request Time: 46370 microseconds
image closed and deleted
Server count is 1
nicolasfranck commented 2 years ago

Maybe this line:

requested_width = region[2];
requested_height = region[3];

should be

requested_width = width;
requested_height = height;

at least if width and height keep being equal to (*session->image)->getImageWidth() and (*session->image)->getImageHeight() respectively

nicolasfranck commented 2 years ago

Mm, I also see that region is not handled everywhere in the same way. With full and square it is handled as if it always contains a value between 0 and 1, and for the others it is just filled with the raw value from the url. That can lead to problems if that value is supplied to session->view->setViewWidth() that only expects a value from 0 to 1..

ruven commented 2 years ago

For reference, this issue is fixed here: https://github.com/ruven/iipsrv/pull/233

nicolasfranck commented 2 years ago

Thanks!