Yes. You can change max_execution_time
on PHP.ini. It is default to 30 seconds
, so any request taking longer than 30 seconds will be interrrupted.
It mostly happens when you try to upload a file with PHP and uploader's upload speed is pretty low so it exceeds the execution duration. PHP will stop and image will be corrupt.
There are different ways to change this value. This question has answers covering the alternatives; Increase max execution time for php
Also, keeping 350 images in a single gallery is overkill. Use paginations.