Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
currently there are only some assumptions about image dimensions which are hard coded in Bookreader.js (D6: fileviewer.js). The appended patch examines these dimensions and makes the values available in the appropriate js-functions.
The functionality is tested in D6. Please check in D7 !
Comment | File | Size | Author |
---|---|---|---|
#2 | fileviewer7-errors.png | 63.4 KB | schildi |
#2 | fileviewer7-imagedim.tgz | 260.6 KB | schildi |
fileviewer-imagedim.patch | 7.51 KB | schildi |
Comments
Comment #1
shenzhuxi CreditAttribution: shenzhuxi commentedschildi, I'm sorry.
I tried your patch and got different problems on chrome and Firefox.
First, it makes everything very slow on both of them (seems because I have a pdf with many pages).
The reader display incorrectly in Chrome.
On firefox only the first page is displayed.
Comment #2
schildi CreditAttribution: schildi commentedHello shenzhuxi
thanks for your efforts testing my half cooked patch. It was tested by me on D6 only.
I invested some time to make it running on D7 too, but there are still some issues remaining:
it looks that the main issues are in "Bookreader" itself. When testing with a three pages PDF document I realized that functions getImageHeight / getImageWidth are called 24 times before the first page is shown.
It helps a lot that there are caches defined by function fv_ImageDim (1 entry) and fileviewer_getimagesize (cache table), but every ajax/json call takes about 300ms to finish (on a 6 years old machine).
Bookreader itself establishes a cache for image dimensions (compare "prefetchedImgs") but seems to not use it.
So, from my point of view function "fileviewer_getimagesize" is fast enough when BookReader uses its own cache as it should.
One possible way of acceleration is to fill fileviewer_getimagesize cache when the PNG images are created. And then load BookReaders internal cache at once when the first page is addressed.
Comment #3
shenzhuxi CreditAttribution: shenzhuxi commentedAfter "Search inside" was added, fileviewer uses a new way for getImageHeight / getImageWidth.
There are still problem for getImageHeight / getImageWidth is "search inside" is turn off.
The bookreader itself needs to improve itself.