Fixed bug in test code and added more in depth logs and fix code styling issues

This commit is contained in:
Christian Wolf 2022-09-23 14:19:20 +02:00
Родитель 34ff60678a
Коммит bd174774d9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -63,7 +63,7 @@ class ImageGenerationHelper {
$fullContent = $fullImage->getContent();
$this->logger->debug('Type of content: ' . gettype($fullContent));
$this->logger->debug('Size of file: ' . $fullImage->getSize());
$this->logger->debug('Full file is readable: ' . $fullImage->isReadable()?'true':'false');
$this->logger->debug('Full file is readable: ' . $fullImage->isReadable() ? 'true' : 'false');
$this->logger->debug('Permissions: ' . $fullImage->getPermissions());
$this->logger->debug('Internal path: ' . $fullImage->getInternalPath());

Просмотреть файл

@ -72,7 +72,8 @@ class ThumbnailService {
$img = $this->getNewImage();
// Store to temp location
$tmpFile = tmpfile();
// $tmpFile = tmpfile();
$tmpFile = fopen('/tmp/tmp-cookbook-img.jpg', 'w');
fwrite($tmpFile, $data);
fflush($tmpFile);
@ -82,15 +83,17 @@ class ThumbnailService {
$this->logger->debug("File stats:\n" . print_r(fstat($tmpFile), true));
$loaded = $img->loadFromFile($filename);
$this->logger->debug('Type of result of loadFromFile: ' . gettype($loaded));
if ($loaded === false) {
$this->logger->debug("Could not load temp file.");
$this->logger->debug('Image is bool ' . is_bool($imagePath)?'true':'false');
$this->logger->debug('Image is file: ' . @is_file($imagePath)?'true':'false');
$this->logger->debug('Image exists: ' . file_exists($imagePath)?'true':'false');
$imagePath = $filename;
$this->logger->debug('Image is bool ' . is_bool($imagePath) ? 'true' : 'false');
$this->logger->debug('Image is file: ' . @is_file($imagePath) ? 'true' : 'false');
$this->logger->debug('Image exists: ' . file_exists($imagePath) ? 'true' : 'false');
$this->logger->debug('Image file size: ' . filesize($imagePath));
$this->logger->debug('Image is readable: ' . is_readable($imagePath)?'true':'false');
$this->logger->debug('Image is readable: ' . is_readable($imagePath) ? 'true' : 'false');
} else {
$this->logger->debug("Loaded image successfully.");
}