}
}
+ // Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely.
+ // Garbage Collection does NOT free this memory. We have to do it ourselves.
+ if ($maxPreviewImage instanceof IImage) {
+ $maxPreviewImage->destroy();
+ }
+
return $preview;
}
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
-use OCP\IImage;
use OCP\IPreview;
use OCP\Preview\IProviderV2;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
$this->fail('Unexpected provider requested');
});
- $image = $this->createMock(IImage::class);
+ $image = $this->createMock(\OC_Image::class);
$image->method('width')->willReturn(2048);
$image->method('height')->willReturn(2048);
$image->method('valid')->willReturn(true);
}
private function getMockImage($width, $height, $data = null) {
- $image = $this->createMock(IImage::class);
+ $image = $this->createMock(\OC_Image::class);
$image->method('height')->willReturn($width);
$image->method('width')->willReturn($height);
$image->method('valid')->willReturn(true);