Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX division by zero #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mwehr
Copy link

@mwehr mwehr commented Sep 26, 2023

Hi,

This fixes division by zero in case a new thumbnail needs to be generated.

kind regards,
Mario

@aolley
Copy link
Collaborator

aolley commented Sep 26, 2023

This will reduce performance when viewing galleries as it always loads the image metadata.

It'd be preferable to simply load this data when its actually needed to generate a new thumbnail as opposed to always.

@mwehr
Copy link
Author

mwehr commented Sep 27, 2023

We have the problem that in case if a new thumbnail is needed, and "Show extended image info" is "No" the width and height are 0.
So the division in the get_image_resized() #320 throws a division by zero.

Another option would be to leave the "if" clause and additionally check for an empty "thumbnail"

if (is_null($thumbnail) ||  $loadextrainfo) {
    $imageinfo = $this->storedfile->get_imageinfo();
    $this->height = $imageinfo['height'];
    $this->width = $imageinfo['width'];
}

What do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants