Fix #1368
Fix #1369
Test case for #1368
Test case for #1369
assertCount(), assertEmpty()
Install imagick
Fix #1370; fix partially #1371
ZEND_DONT_UNLOAD_MODULES=1
Code deduplication
getInternalImInstance()
setResourceLimit()
Updated tests