protected function checkMemory($imagepath) { }
protected function checkMemory($imagepath) {
$memory_available = memory_get_available();
if ($memory_available !== false) {
$imagedata = getimagesize($imagepath);
if ($imagedata === false) {
return;
}
if (!isset($imagedata['channels'])) { // assume RGB (i.e. 3 channels)
$imagedata['channels'] = 3;
}
if (!isset($imagedata['bits'])) { // assume 8 bits per channel
$imagedata['bits'] = 8;
}
$memory_required = (int)ceil($imagedata[0] * $imagedata[1] * $imagedata['channels'] * $imagedata['bits'] / 8);
if ($memory_required >= $memory_available) {
throw new SIGPlusOutOfMemoryException($memory_required, $memory_available, $imagepath);
}
}
}
/*protected function checkMemory($imagepath) {
$memory_available = memory_get_available();
if ($memory_available !== false) {
$imagedata = getimagesize($imagepath);
if ($imagedata === false) {
return;
}
if (!isset($imagedata['channels'])) { // assume RGB (i.e. 3 channels)
$imagedata['channels'] = 3;
}
if (!isset($imagedata['bits'])) { // assume 8 bits per channel
$imagedata['bits'] = 8;
}
$memory_required = (int)ceil($imagedata[0] * $imagedata[1] * $imagedata['channels'] * $imagedata['bits'] / 8);
if ($memory_required >= $memory_available) {
throw new SIGPlusOutOfMemoryException($memory_required, $memory_available, $imagepath);
}
}
}*/
Time to create page: 0.064 seconds