Jump to content

Recommended Posts

Hi all

I have a problem here. I created a gallery with 240 pictures. Created an images field with no maximum amount (0). Unfortunately, only 98 of the 240 images show on the website. Any idea what I possibly could have done wrong? Thanks for your help!

<?php 
        foreach ($page->images as $image) {
        $options = array(
          'quality' => 90,
          'upscaling' => false
        );
        $thumb = $image->size(250, 250, $options);
      ?>
        <div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-6 foto">
         <a href="<?= $image->url ?>" data-lightbox="lightbox" >
          <img src="<?= $thumb->url ?>" alt="" >
         </a>
        </div>
      <?php } ?>

 

Share this post


Link to post
Share on other sites

Could be your server is running out of memory maybe? No white screens or errors? Just guessing. See this thread as well.

 

Share this post


Link to post
Share on other sites
Quote

only 98 of the 240 images show on the website.

240 images are too many to show on a single webpage and can choke the browser and eat away too many resources.

Try 40 or 60 images per webpage and use pagination.

Share this post


Link to post
Share on other sites

it does actually render the rest of the website correctly. It just stops after 98 pictures. and by the way, it's only thumbnails...

Share this post


Link to post
Share on other sites
6 hours ago, kongondo said:

What does echo $page->images->count() return;?

it returned 96. Then I added the files like 10 at once instead of 50 and then it worked again. for a while. up to 162 images. Then the same again. I can add more pictures, save the page, leave and come back to it and the images are gone (the ones I just uploaded). this is really weird...

Share this post


Link to post
Share on other sites

Have a look in the file system for the 'created' image thumbs (/site/assets/files/1234/, where 1234 is the ID of the page with the images. Were the 250 by 250 image thumbs created correctly or they are not viewable/blank? Also, what size are the images you are uploading? 

Share this post


Link to post
Share on other sites
13 hours ago, kongondo said:

Have a look in the file system for the 'created' image thumbs (/site/assets/files/1234/, where 1234 is the ID of the page with the images. Were the 250 by 250 image thumbs created correctly or they are not viewable/blank? Also, what size are the images you are uploading? 

Well, it seems that the problem starts much earlier. I can upload around 150 images (width 1600px, size between 300 and 600KB), after that, processwire does not store them anymore.....

Share this post


Link to post
Share on other sites

That's a bug in PW that's in there since years. I once tried to make sense of it but after hours of try and error I gave up. If you upload a bunch of images (only drag and drop), sometimes images get lost on the way, though they're uploaded they're not saved in DB. All issue reports end up having "not reproducible, needs more information, discussion". Ryan's too busy with new features than trying to track down those (understandable though if you can't reproduce).

Share this post


Link to post
Share on other sites
6 minutes ago, Soma said:

That's a bug in PW that's in there since years. I once tried to make sense of it but after hours of try and error I gave up. If you upload a bunch of images (only drag and drop), sometimes images get lost on the way, though they're uploaded they're not saved in DB. All issue reports end up having "not reproducible, needs more information, discussion". Ryan's too busy with new features than trying to track down those (understandable though if you can't reproduce).

Thanks for the info, Soma. What would you suggest? Just try and hope it works at some point? do you have a workaround idea? Several image fields?

Share this post


Link to post
Share on other sites

No. Upload via classic upload, or just 2-3 at a time.

Share this post


Link to post
Share on other sites
16 minutes ago, Soma said:

No. Upload via classic upload, or just 2-3 at a time.

it doesn't work. even if i go one by one. it stops at 162 images...... 

Share this post


Link to post
Share on other sites

I just uploaded 300 images without problem. Sorry don't know.

Share this post


Link to post
Share on other sites

Well can't say without problems, cause the editor gets really unresponsive and it doesn't save anymore... well.

Edit: well looks like it was hanging a lot and after couple minutes I was able to edit again as it seems it finally deleted all files, but it's not made for such large amounts.

Share this post


Link to post
Share on other sites
2 hours ago, rolisx said:

What would you suggest?

Is this a personal site? You can use the API to upload images as well as resize them. 

  • Like 1

Share this post


Link to post
Share on other sites
22 hours ago, rolisx said:

I can add more pictures, save the page, leave and come back to it and the images are gone (the ones I just uploaded).

This might be relevant:

 

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By psy
      I've searched, and maybe missed, the solution. I have a 'normal' images field and uploading images with a file size greater than 10Kb is fine. Any image size smaller results in the never-ending spinner and no upload.
      No min/max width/height set on image uploads in admin, ie just the defaults.
      Any ideas on how to fix?
      Using:
      PW: 3.0.175
      PHP: 7.3
      Marking it as "Resolved" rather than "Solved" as it auto-magically fixed itself. No idea whether PW, PHP, or just an internet hiccough... All good now 🤞
    • By totoff
      Dear all,
      tomorrow I'll have to introduce some editors on how to upload and edit images in image fields in Processwire. The site in question is quite image rich and I've spent some time to serve the appropriate images via scrcset already cropped for different screen sizes.
      However, the backend offers a lot of possibilities to manipulate images and most of them I'm not familiar with because as a developer I've never spent much thinking on what all the features might be good for … Yet I'm concerned that my editors work on images in the backend may interfere with my optimization strategies in the templates.
      Is there a general rule of thumb what content editors should do or not do with images in order not to break srcset strategies etc.? Maybe there is already a source of information you could point me to?
      Your recommendations are much appreciated!
    • By totoff
      Dear all,
      I'm upgrading an older side with the new custom fields for images feature as of 3.0.142. My image field is set to "Automatic" and holds a bunch of images together with their respective description on each page. New custom fields include "caption" among others and to make my live easier I I'm trying to populate "caption" with the value from the (default) description field. But unfortunately I can't seem to find out how to save the newly set values. This is my code:
      <?php foreach (page()->images as $image) { $image->set('caption', $image->description); bd($image->caption); echo files()->render("markup/views/view-card-image-fancybox.php", array('image'=>$image)); } ?> <?php $page->save(); bd($page->save()); ?> This sets the value as intended (see screenshot) but doesn't save it permanently to the database. What am I doing wrong?
      Thanks!
       

    • By dalibor
      I'm using hook for retrieving data from image metadata (IPTC) after image upload and filling them to some fields. When I choose server-side image resize, everything works well. But when I use client-side resize (which si much faster and client comfortable  - it uses PWImageResizer.js) image metadata are lost during resizing - I have downloaded the file after resize and checked for EXIF, IPTC etc. and they are not present.  Using PW 3.0.165. Tried to look into PWImageResizer.js but uhh it's too javascreepy to me:) 
    • By fruid
      I'm using custom fields for images (as mentioned here: processwire.com/blog/posts/pw-3.0.142) for a specific images-field, the images of which need to have an HTML-caption. It works fine so far. Now I'm trying to import pages that use this field. I first exported some pages of that kind to see what the spreadsheet would look like. It seems to not separate the captions for each images but instead put all images in one cell and all captions in another.
      How could I go about importing these pages and assign the captions to the images accordingly?
×
×
  • Create New...