$object = $parameters['object'];
}
+ $adapter = ImageHandler::getInstance()->getAdapter();
// rotate image based on the exif data
if (!empty($this->options['rotateImages'])) {
if ($object->isImage) {
- if (FileUtil::checkMemoryLimit($object->width * $object->height * ($object->fileType == 'image/png' ? 4 : 3) * 2.1)) {
+ if ($adapter->checkMemoryLimit($object->width, $object->height, $object->fileType)) {
$exifData = ExifUtil::getExifData($object->getLocation());
if (!empty($exifData)) {
$orientation = ExifUtil::getOrientation($exifData);
if ($orientation != ExifUtil::ORIENTATION_ORIGINAL) {
- $adapter = ImageHandler::getInstance()->getAdapter();
$adapter->loadFile($object->getLocation());
$newImage = null;
return;
}
+ $adapter = ImageHandler::getInstance()->getAdapter();
+
// check memory limit
- if (!FileUtil::checkMemoryLimit($file->width * $file->height * ($file->fileType == 'image/png' ? 4 : 3) * 2.1)) {
+ if (!$adapter->checkMemoryLimit($file->width, $file->height, $file->fileType)) {
return;
}
- $adapter = ImageHandler::getInstance()->getAdapter();
$adapter->loadFile($file->getLocation());
$updateData = [];
<?php
namespace wcf\system\upload;
use wcf\data\user\cover\photo\UserCoverPhoto;
+use wcf\system\image\ImageHandler;
use wcf\system\WCF;
use wcf\util\ExifUtil;
-use wcf\util\FileUtil;
/**
* Upload file validation strategy implementation for user cover photos.
// estimate if there is enough memory for a resize, if there is,
// we do not need to mark an image which is too high or too wide
// as invalid
- $sufficientMemory = FileUtil::checkMemoryLimit($width * $height * ($uploadFile->getFileExtension() == 'png' ? 4 : 3) * 2.1);
+ $sufficientMemory = ImageHandler::getInstance()->getAdapter()->checkMemoryLimit($width, $height, $imageData['mimeType']);
// check width
if ($width < UserCoverPhoto::MIN_WIDTH) {