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

How to don't create imageSizeBig ? #46

Open
Zatalyz opened this issue Oct 24, 2023 · 2 comments
Open

How to don't create imageSizeBig ? #46

Zatalyz opened this issue Oct 24, 2023 · 2 comments

Comments

@Zatalyz
Copy link

Zatalyz commented Oct 24, 2023

Hello,
Thanks for your great code, it's very nice.

I have a problem: when I click on an image (to see it on the lightbox), it creates an image with the dimensions indicated in "Site.php", in the "imageSizeBig" parameter. And so, this fills the cache folder.

I don't want to generate a new version of the image here, but just display the image stored in my source folder, whether it's really too small or really too big.

Is there a way to have this behaviour?

@keusendev
Copy link

Hi

I have the same issue. All the images are already in an optimized format. I very much like to see an option to disable this behaviour 👍.

BTW great and simple gallery ❤️. We also supported the project/product by buying the Pro version 😃.

@awong234
Copy link

awong234 commented Feb 5, 2024

I think I've solved it:

In nova-themes/novagallery/album.php, around line 36, modify the code so that the image link itself does not have pass a $size argument:

<a href="<?php echo Image::url($album, $element); ?>"> <!-- <------------ here remove the Site::config('imageSizeBig') argument -->
  <img src="<?php echo Image::url($album, $element, Site::config('imageSizeThumb')); ?>" loading="lazy" class="rounded"><br>
</a>

Do the same in the nova-themes/novagallery/home.php file.

Then, in nova-base/lib/image.php, modify the lines around 83-89:

$url = IMAGES_URL.'/'.$album.'/'; <!-- Changed so that it does not point to cache -->

if($size){
  $url = IMAGES_URL.'/'.$album.'/cache/'; <!-- Points to cache here -- it really only needs to do this for the thumbnails, or if the user actually wants to cache an imageSizeBig config  -->
  $url .= $size.'/';
}

I don't have a pull request out yet, because I think it can be handled better at the site config level. For instance, if imageSizeBig: 'original' is set (or something like that) , then the code can test against that and handle whether to add the 'cache' to the URL or not.

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

No branches or pull requests

3 participants