Jump to content

Resizing images on upload problem


wayne.davies
 Share

Recommended Posts

Hi I have an image field in the back end, that expects multiple images. Now I've added this hook as the files are added:

$page->addHookAfter('InputfieldFile::fileAdded', function($event) {
    $inputfield = $event->object;
    wire('log')->save('image-resizing', "Resizing ");
    $image = $event->argumentsByName("pagefile");
    $image->size(800,0,array('upscaling' => false));
    $image->size(300,200,array('cropping' => true, 'quality' => 80 ));
  });

It works absolutely fine for a small amount of images, but uploading a large amount doesn't seem to work. No errors are logged either.

Now all thes photos appear to have uploaded in the back end, and show the thumbnails, but upon clicking save images are missing.

I've checked all my php settings and ensured they are all adequate enough.

memory_limit 512mb
upload_max_filesize 200mb
max_execution_time 300

If I disable this hook, I can upload all images fine.

Please could anyone other any insight into what may be causing this issue?

Thanks in advance :)

 

 

 

Link to comment
Share on other sites

If you can, disable the session DB-handler. It is known for this behave in regard with multiple parallel images uploads.
Or, if you cannot switch to session handling via files, the only other alternative is to switch PW Version up to PW 3.0.21+ (?) not sure the correct version where DB-Sessionhandler was updated / corrected.

Other possiblities are not there in your case, I believe.

  • Like 4
Link to comment
Share on other sites

Sorry, I forgot about it. Another solution would be to stick with PW 2.7 and the (old) SessionHandler-DB, but uploading multiple images packed into a ZIP!

(only one ZIP at a time)

This I uses on a client side with (old) SessionDB-Handler since PW 2.5, (upgraded to 2.6, then to 2.7) for years now, and it works correct! :)

  • Like 1
Link to comment
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
 Share

×
×
  • Create New...