custom cache image size not generated in news

vincent3569 Member, Translator

hi,
for my personnal needs, I use some custom cache image sizes in news to have original layouts (eg with isotope).
you can see this news as example: https://www.vincentbourganel.fr/news/randonnee-au-rocher-du-playnet-la-troisieme-fut-la-bonne/

for example, I have cache image name like:
/cache/images/photos-du-mois/img_1896_w767_h511_cw1100_ch733.jpg and
/cache/images/photos-du-mois/img_9677_w250_h250_cw734_ch734_cx110_cy0.jpg.

there was a time, with cache image manager, and 'cache stored images' tab, these cache images was generated.
since few time (I don't know when), cache image manager doesn't create cache images but a visit with FE generates it.
now (sine latetest release), cache image manager doesn't create cache images and a visit with FE doesn't generate it anymore.

you can see this news as example: https://www.vincentbourganel.fr/news/randonnee-au-rocher-du-playnet-bis-repetita/

what is the matter?

«1

Comments

  • acrylian Administrator, Developer

    Actually that should work as usual. Nothing to the actual handling change except the way cacheimages are generated. You might want to try the support build and make sure the cachemanager where you can choose how images are generated: Legacy mode (images are printed) and cURL (images are generated by a request).

    For some reason the actual more reliable cURL mode is not working as reliable on every server. It does work fine and better on my local and my servers incl. zenphoto.org but for example not on Fretzl's. We couldn't find out why. Perhaps that is what you are encountering.

  • acrylian Administrator, Developer

    I fear I can somehow reproduce this and it has nothing to do with the cURL vs legacy mode. Not sure how we missed that but we did naturally test it with all the cachemanager changes. The actual logic for image discovery within text didn't change actually. Will take a look…

  • vincent3569 Member, Translator
    edited February 2019

    I don't speak about images in albums.
    I speak about 'cache stored images' tab of cache manager.

    what this feature is supposed to do and how it is supposed to work?

    as far I can read, it is supposed to do 2 different things:

    • first, "if image processor URI is discovered it will be converted to a cache file URI".
      so, if a link to image like this <img src="/zp-core/i.php?a=20110721-vacances-ete-pays-basque&i=img_5671.jpg&w=800&h=189&cw=1100&ch=260&cx=0&cy=40" /> is found in a news content, it is supposed to be converted to <img src="/cache/20110721-vacances-ete-pays-basque/img_5671_w800_h189_cw1100_ch260_cx0_cy40.jpg" />.

    right ?

    • second, "if the cache file for the image does not exist, a caching image reference will be made for the image".
      so, the relevant cache image for <img src="/cache/20110721-vacances-ete-pays-basque/img_5671_w800_h189_cw1100_ch260_cx0_cy40.jpg" /> is supposed to be created.

    right ?

    as far I can test, both of these items aren't working as expected:
    image processor URI are not converted, and cached images of images in news/pages contents are not created with this tab of cache manager (no matter if generated by tinyZenpage - with custom size -, or manually created - as I know the internal structure of cached images -, as I have to do for my personnal layouts in news contents).
    we have to visit news/page from the front-end to create theses cache images.

    it works in the past (it was a feature request of mine, and stephen worked on it).

  • acrylian Administrator, Developer

    Yes, that is how it is supposed to work. And as mentioned I can reproduce this not working correctly. I will take a look what's going on there (or what not specifially).

    As mentioned before in the future embedded images will be using a content macro - which I sometime soon will add - which should be used preferredly. It has a lot of benefits as being indepedent from any url structure and also can cover missing images without showing broken ones. Addtionally it can incorporate any caption structure additionally. Drawback is of course there is no live preview in edit mode anymore then.

  • vincent3569 Member, Translator

    I missed something:
    cache image for "complex" custom sized images like <img src="/cache/20110721-vacances-ete-pays-basque/img_5671_w800_h189_cw1100_ch260_cx0_cy40.jpg" /> are not created when I visit my news from the front-end.

    it's really annoying because many of my news have missing images and I need to generate the cached images manually by calling i.php in debug mode. very long and very painful with a lot of pictures.

    a macro content to add an image sized as we want (ie with all the possible parameters of i.php: s, w, h, cw, ch, cx, cy... and more: class, alt,...) would be a VERY nice improvement.

  • acrylian Administrator, Developer

    Out of my head I cannot tell if that cache image name is really correct. Remember we had cache images broken and then fixed it. Sure that isn't one of those older ones? I am quite sure we didn't change anything beside that…

  • acrylian Administrator, Developer
    edited February 2019

    So I found something out: Is your site perhaps using the "protect image cache" option? Then this is the cause. If enabled you always get i.php thus no cache file references works and generates anything. Also for the same reason the cache db images is not working either.

    At least that is what I can reproduce.

    That mode is not recommended anyway as it seriously slows down the site because of extra overhead. As the option text notes.

  • vincent3569 Member, Translator

    I don't use that option.
    the cache image name above is given by i.php, so it should be correct.

  • acrylian Administrator, Developer

    okay, good. But then I fear I cannot reproduce it. But I can partly reproduce the issue you reported on https://forum.zenphoto.org/discussion/1410404/wrong-custom-size-with-png-file#latest Although only for embedded images as it seems.

  • vincent3569 Member, Translator
    edited February 2019

    the way I do (and maybe, steps to reproduce for you):

    • generate a custom sized cache image using i.php:
      http://domain_name/zp-core/i.php?a=album_name&i=image_name.jpg&w=Width_value&h=Height_value&cw=Crop_width_value&ch=Crop_height_value. you can temporary add &debug to see the custom sized picture in your browser

    • copy/paste the generated url (should be like http://domain_name/cache/album_name/image_name_wWidth_value_hHeight_value_cwCrop_width_value_chCrop_height_value.jpg) in the source code of a news.

    • clear cache
    • use 'cache stored images' tab

    in my case, nothing appends and custom cache image is not created.

  • acrylian Administrator, Developer

    Had tested that with maxspace images as Zenpage uses on the image page and that works as intended for me. WIll try with a more complex sizing later.

  • fretzl Administrator, Developer

    Tried some custom sized/cropped images and it all works as expected.

  • acrylian Administrator, Developer
    edited March 2019

    I can reproduce the issue with gif and png images and working on it.

  • acrylian Administrator, Developer
    edited March 2019

    Please try the support build.

  • acrylian Administrator, Developer
    edited March 2019

    Sorry, my above replies where in the wrong topic and referred to https://forum.zenphoto.org/discussion/1410404/wrong-custom-size-with-png-file#latest

  • vincent3569 Member, Translator

    I tried latest build, but nothing changes with my cache custom sized pictures not generated.

  • acrylian Administrator, Developer

    There has been no work on it yet since we were not able to reproduce it.

  • acrylian Administrator, Developer
    edited March 2019

    Good news: We were able to reproduce it. Bad news: There will be no fix.

    We found out this: Reason is that your image filename name has a number:

    img_1896.jpg gets a cache name like img_1896_w767_h511_cw1100_ch733.jpg.

    Now the 1896 is misunderstood as the "size" parameter which is the only one that has no char prepended. For example img_1896.jpg could be an uncropped sized image of img.jpg with width (depending on options and orientation) 1896px.

    This does only happen which images named like this and only within text content like pages or articles. It does not happen within normal theme context using theme functions because there it is "known" what the actual image file name part is and what not.

    So the only fix is to rename the image (e.g. img_1896.jpg to img-1896.jpg). The content macro I will start working on should fix this.

  • vincent3569 Member, Translator
    edited March 2019

    It's very annoying
    why size parameter is not prepended by "s" as "w" for width?
    so there would be no ambiguity and a custom sized cache name would be like img_1896_s767_cw1100_ch733.jpg
    it would be a huge work to rename all pictures of my gallery (and be carefull of lost date).
    and btw, using "_" is a common syntax for naming of pictures...

  • acrylian Administrator, Developer
    edited March 2019

    I agree somewhat and don't understand either why that "s" isn't there. But it actually never was.

    But if we now add the "s" you need to re-embedd all images in articles, all cache images invalidate and need to be regenerated.

    Remember what happened when we changed the cache file name the last time accidentally…

    All reason more to introduce the content macro which always will cover any change made…

  • vincent3569 Member, Translator

    is a huge issue for me :-(
    there should be a notice in that news: https://www.zenphoto.org/news/problems-with-albums-and-images/#------embedded-images-in-zenpage-articles-or-pages

    btw, I tried to rename a picture from img_9644.jpg to img-9644.jpg and change <img src="/cache/[...]/img_9644_w760.jpg" alt="img_9644" /> to <img src="/cache/[...]/img-9644_w760.jpg" alt="img-9644" /> in a news content.
    the cache image is created when I visit the news.
    but the cache image is not generated when I use 'cache stored images' tab of cache manager.

  • acrylian Administrator, Developer

    The issue was actually undiscovered until now and must exists since the beginning. No one every noticed or no one uses images in articles or pages… Anway the macro will fix this at least for new images.

    but the cache image is not generated when I use 'cache stored images' tab of cache manager.

    That is the other issue you reported we could not reproduce so far.

  • vincent3569 Member, Translator
    edited March 2019

    That is the other issue you reported we could not reproduce so far.

    can you explain your own steps to reproduce?

  • acrylian Administrator, Developer
    edited March 2019

    Not sure what you mean. I added an image via tinyZenpage to a page as usual, openend the page to be sure there is a cached one and cleared the cache. Then used the cache stored images tab of the cachemanager to re-generate it as intended. Naturally it will also fail with above limitation.

  • vincent3569 Member, Translator
    edited March 2019

    ok
    to see the issue, you have to follow my steps above (because tinyMCE doesn't allow "full custom" sizing):

    • generate a custom sized cache image using i.php: http://domain_name/zp-core/i.php?a=album_name&i=image_name.jpg&w=Width_value&h=Height_value&cw=Crop_width_value&ch=Crop_height_value. you can temporary add &debug to see the custom sized picture in your browser

    • once done, copy/paste the generated url of cached image (should be like http://domain_name/cache/album_name/image_name_wWidth_value_hHeight_value_cwCrop_width_value_chCrop_height_value.jpg) in the HTML code of a news (without using tinyMCE or by editing source code), ie add this html code: <img src="/cache/album_name/image_name_wWidth_value_hHeight_value_cwCrop_width_value_chCrop_height_value.jpg" />

    • clear cache
    • use 'cache stored images' tab to generate cache image for stored image

    an exemple of a cropped and resized picture of my gallery: <img src="/cache/20110721-vacances-ete-pays-basque/img-5671_w800_h189_cw1100_ch260_cx0_cy40.jpg" />

    in my case, the relevant custom cache image is not created.

  • acrylian Administrator, Developer

    Ok, I will try that again. That naturally should work with any cacheimage.

    And we surely will extend tinyZenpage to cover all image settings in the future. It is scheduled to being reworked completly anyway. But perhaps with the content macro that will be even in this version. We'll see.

  • fretzl Administrator, Developer

    I now see that the issue is caused by both an underscore and a hyphen followed by a number.

  • acrylian Administrator, Developer

    Makes sense sadly, ZP still misunderstands the first number following text as the size parameter if not in a regular theme context. This issue should also not appear there as explained, right?

    Since we don't want to change the cachefilenames forcing everyone on large sites to re-cache everything, the content macro is the only pragmatic solution. Not sure I can replace embedded image svia the cachemanger since the macro will create a full <figure><img><figcaption> setup to cover title and descriptions usages.

  • vincent3569 Member, Translator
    edited March 2019

    hi
    in fact, I think that 'cache stored images' tab never works.
    a simple sized picture in a new content, as following, is not recached:
    <img src="/cache/images/photos-du-mois/_mg-3167_500.jpg" alt="_mg-3167" />.

    hopefully, after changing some '_' in '-' in some news, I fixed my issue (cache images are generated), but I allways have to visit my news to generate cache images (whatever the size they have, custom or not).

  • vincent3569 Member, Translator

    's' for image size, 'cache stored images'...
    some oddities that should have been reworked long time ago...but of course there is not a huge team to do that :-(

Sign In or Register to comment.