Join GitHub today
Update fetch() for portrait oriented images #60
This code was added to allow multiple fetch() commands to work correctly when there is a mix of portrait and landscape oriented images to display on the PyPortal. An additional parameter, image_dim_json_path, was added to init() to point to the JSON section that contains the original width and height of the image. If this parameter (a width and height tuple) is not present, the fetch should work as before with no portrait mode considerations.
Here is an example of the feature being used. I commented out some of the lines so the code could run without external file dependencies. Specific landscape and portrait itemids can be uncommented for testing, or use the randomint() function.
More info on the api used in the example is here: https://openaccess-api.clevelandart.org/