for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace OCA\FaceRecognition\Helper;
use OCA\FaceRecognition\Helper\MemoryLimits;
use OCA\FaceRecognition\Service\SettingsService;
class Requirements
{
public static function hasEnoughMemory() {
$memory = MemoryLimits::getSystemMemory();
return ($memory > SettingsService::MINIMUM_SYSTEM_MEMORY_REQUIREMENTS);
}
public static function pdlibLoaded() {
return extension_loaded('pdlib');
/**
* Determines if FaceRecognition can work with a givem image type. This is determined as
* intersection of types that are supported in Nextcloud and types that are supported in DLIB.
*
* Dlib support can be found here:
* https://github.com/davisking/dlib/blob/9b82f4b0f65a2152b4a4243c15709e5cb83f7044/dlib/image_loader/load_image.h#L21
* Note that Dlib supports these if it is compiled with them only! (with libjpeg, libpng...)
* Based on that and the fact that Nextcloud is superset of these, these are supported image types.
* @param string $mimeType MIME type to check if it supported
* @return true if MIME type is supported, false otherwise
*/
public static function isImageTypeSupported(string $mimeType): bool {
if (
($mimeType === 'image/jpeg') or
($mimeType === 'image/png') or
($mimeType === 'image/bmp') or
($mimeType === 'image/gif')) {
return true;
} else {
return false;
return false
false
true