I am trying to write a PHP script that will perform the following:

1. Extract all files from an archive in a given directory (using the exec function to actually run 7z)
2. List all the files that are images (jpg, jpeg, gif, png) and store them in an array (using exec again to run "ls" and storing only the images in the array, I compare the extension)
3. Cycle through the array and for each image:
	1. Move that image in a unique folder
	2. Generate thumbnails in that same unique folder (I use [PHP Thumbnailer](http://phpthumb.gxdlabs.com/))
	3. Record that new image in a database

For a small number of images, I would say that the script works ok (it could probably be improved a lot).

My problem is that after a certain number (which seems random each time I run my script) of treated images, I get a fatal error:  

**PHP Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/ims/public\_html/dev/include/phpThumb/GdThumb.inc.php on line 217**

```
imagecopyresampled
(
    $this->workingImage,
    $this->oldImage,
    0,
    0,
    0,
    0,
    $this->newDimensions['newWidth'],
    $this->newDimensions['newHeight'],
    $this->currentDimensions['width'],
    $this->currentDimensions['height']
); // <- this is line 217

```

I am hoping that someone could point me towards a reason for that timeout. Is the GD library limited ?
Should I install a dedicated software on my linux server to specifically perform this task?

Thanks for your help.