how to refresh cache image for pictures used in news/pages ??

vincent3569 Member, Translator
hi

in some news, I use pictures from my gallery (some of my public albums, some of my private albums to illustrate the news/pages, some pictures used as thumbnail, some pictures used as resized pictures to suit my needs, but in most case, with a different size from gallery).

sometimes, I delete my cache image to refresh it.

in that case, with new releases of zenphoto, cache of pictures in the news are not regenerated and pictures are not displayed !

for example, before, in my news I have a link to picture like `src="/zp-core/i.php?a=[album_name]&i=[image_name].jpg&s=500&wmk=%21"`
and cache image was refreshed after I deleted it.
but now, the link to picture is like `src="/[album_name]/[image_name]_500.jpg`
but cache image is not refreshed if I detete it.

If I delete my cache (intentionally or by mistake), how can I refreh it for all picture, both in my gallery and news/pages ?

Comments

  • acrylian Administrator, Developer
    Yes, that is because otherwise a lot of overhead would occur if i.php is called each time.
    The cacheManager has an option to re-cache these images via the admin overview button of it.

    Believe it or not even I was confused by that recently and somehow missed that sbillard had added this.

    Update: I have added info about that to the related user guide article:
    http://www.zenphoto.org/news/problems-with-albums-and-images#embedded-images-in-zenpage-articles-or-pages-are-b
  • vincent3569 Member, Translator
    Thanks Malte for your answer.

    I am not sure to understand: all pictures on news/pages don't have the same size/format.
    With cacheManager, how can I cache one picture in one size/format and another picture in another size/format?
    If I have to individually cache each pictures in news/pages, it's a little bit fastidious, don't you think (I have almost 70 news, with a lot of specific sizes/formats)?

    There is no solution to use i.php rather than cache url?
    with the gallery, if cache image doesn't exit, cache image is automatically refreshed.
    Why this behaviour doesn't exist with news/page?
  • with the gallery, if cache image doesn't exit, cache image is automatically refreshed.
    This is because there is a direct link in the data to the cached image, so no intervention. I suppose it would be possible to make the 404 handler discover this and cache the image. Haven't looked at that though. But maybe a good idea for an issue ticket.

    The cache manager goes an looks for such links and re-caches when you select that option. So really, the best thing for you do do is to run that function when you delete your cache either deliberately or accidentally.
  • vincent3569 Member, Translator
    Sometimes, I use custom thumbnail cropping.
    With cacheManger, the generated thumbails use custom cropping ?
  • acrylian Administrator, Developer
    Yes, if you look at the cached image filenames you will see they always mirror the options set to create them. Otherwise we could not check if one is cached already or not. So it should genereate the news/page embedded ones correctly.
  • vincent3569 Member, Translator
    I ash my question more specifically:
    If I create an option for Cachemanager for my own theme (s=85, cw=85, ch=85, thumb=true, without crop and crop x axis y axis)
    If I have some pictures in the gallery and I used a custom thumbnail cropping, does Cachemanager will see it and generate the "right" thumbnail (with all cropping information)?
  • If I understand correctly you are asking if your cachemanager parameters will cache a custom cropped image. Of course not unless the custom crop is the same as the parameters you have set. Cachemanager makes cached images based on the settings you tell it to use.
  • vincent3569 Member, Translator
    I did not ask my question properly.
    For thumbnails with custom cropping, cropping data are stored in database (thumbX, thumby, thumbW, thumbH).

    Is there a way go generate all thumbails with only one instruction of cacheManager, both those with a standard cropping (cw=85, cy=85) and those have cropping data are stored in database?

    In others word, cacheManager are using cropping data stored in database, or apply only settings?
  • acrylian Administrator, Developer
    It only caches what is registered to it. So no, it does not look through the images table.
  • vincent3569 Member, Translator
    so, this plugin cacheManager is convenient, but still a bit limited...

    I think it should work as follows:
    - For each theme, explore the database to discover the size of the thumbnails (thumb_size, thumb_crop, thumb_crop_width, thumb_crop_height) and image size (image_size, image_use_side) and generate the cache thumbs and pictures.

    - If thumb is checked, cacheManager should use cropping data stored in database.
  • For each theme, explore the database to discover the size of the thumbnails (thumb_size, thumb_crop, thumb_crop_width, thumb_crop_height) and image size (image_size, image_use_side) and generate the cache thumbs and pictures.
    Actually, the only thing is the database for the images are the crop height, width, x, and y values. The other items are from theme options. Since the theme defines the parameters to the cache manager, all that is needed is to retrieve the custom crop values if they exist.

    This is done.
  • vincent3569 Member, Translator
    thanks sbillard
    it will be in the next minor 1.4.5.6 release or it if for the next main release 1.4.6 ?
  • acrylian Administrator, Developer
    Both, it is already in the master/dev builds. You can always review changes here:
    https://github.com/zenphoto/zenphoto/commits/master
  • vincent3569 Member, Translator
    Hi

    I have some tests with new improvement.
    It seems there is something going wrong with cache processing and custom thumbnail cropping...

    I have a picture with followind data :
    height 733
    width 1100
    thumbX 0
    thumbY 0
    thumbW 733
    thumbH 733
    (a squared thumb 733x733 of left corner of picture)

    with official 1.4.5.5
    a correct custom cache image is generated : img_xxxx_w85_h85_cw734_ch734_cx0_cy0_thumb.jpg

    with current support build of 1.4.5.5
    a wrong custom cache image is generated :
    img_xxxx_w85_h85_cw85_ch85_cx734_cy734_thumb.jpg
  • Some more details please:

    Is this using the cache manager?
    What are the parameters of the cache setting in the "apply"?
  • vincent3569 Member, Translator
    I don't use cacheManager
    these wrong thumbnails are generated when I "visit" the gallery for the first time (or when cache is empty).
  • vincent3569 Member, Translator
    forgive my previous message, I uploaded latest support build and I don't have the issue anymore...
  • vincent3569 Member, Translator
    your improvement works great, thanks.

    I suggest you to add some explanations in http://www.zenphoto.org/news/cachemanager and
    http://www.zenphoto.org/news/caching.

    Maybe, something like that :

    With cacheManager, you can easily cache the thumbnails of your gallery (both with a standard size and with custom cropping).

    if not existing, you have to create a new type of cache (for example, with size = 85, cropping width = 85, cropping hight = 85, thumbnail = true)
    cacheManager will create
    - img_xxxx_w85_h85 for standard thumbnails
    - img_xxxx_w85_h85_cwXXX_chYYY_cxX_cyY_thumb.jpg for custom cropped thumbnails
Sign In or Register to comment.