]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use Image class from public API 32696/head
authorChristopher Ng <chrng8@gmail.com>
Thu, 2 Jun 2022 00:37:36 +0000 (00:37 +0000)
committerChristopher Ng <chrng8@gmail.com>
Thu, 2 Jun 2022 00:37:36 +0000 (00:37 +0000)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
16 files changed:
apps/dav/lib/CardDAV/PhotoCache.php
apps/settings/lib/UserMigration/AccountMigrator.php
core/Controller/AvatarController.php
lib/private/Avatar/Avatar.php
lib/private/Avatar/UserAvatar.php
lib/private/Preview/Bitmap.php
lib/private/Preview/Bundled.php
lib/private/Preview/Generator.php
lib/private/Preview/HEIC.php
lib/private/Preview/Image.php
lib/private/Preview/MP3.php
lib/private/Preview/MarkDown.php
lib/private/Preview/Movie.php
lib/private/Preview/Office.php
lib/private/Preview/SVG.php
lib/private/Preview/TXT.php

index 777a0b0e16945152410be141f944d749b6a86af8..101111f93100f9dc42cc5f8fa709688b56806826 100644 (file)
@@ -133,7 +133,7 @@ class PhotoCache {
                                throw new NotFoundException;
                        }
 
-                       $photo = new \OC_Image();
+                       $photo = new \OCP\Image();
                        /** @var ISimpleFile $file */
                        $file = $folder->getFile('photo.' . $ext);
                        $photo->loadFromData($file->getContent());
index bf1af10d46444b7c29169e1107a583cc93e61da5..4db28306eb1baf3b5d56a6a9877114df8ed13e49 100644 (file)
@@ -153,7 +153,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
 
                        $output->writeln('Importing avatar from ' . $importPath . '…');
                        $stream = $importSource->getFileAsStream($importPath);
-                       $image = new \OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromFileHandle($stream);
 
                        try {
index e75b3493185a115f0b62616635e54cfe8d5388ba..2ef219af498833acc57c1d30994341a677035bf4 100644 (file)
@@ -201,7 +201,7 @@ class AvatarController extends Controller {
                }
 
                try {
-                       $image = new \OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromData($content);
                        $image->readExif($content);
                        $image->fixOrientation();
@@ -260,7 +260,7 @@ class AvatarController extends Controller {
                                                                        Http::STATUS_NOT_FOUND);
                }
 
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData($tmpAvatar);
 
                $resp = new DataDisplayResponse(
@@ -296,7 +296,7 @@ class AvatarController extends Controller {
                                                                        Http::STATUS_BAD_REQUEST);
                }
 
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData($tmpAvatar);
                $image->crop($crop['x'], $crop['y'], (int)round($crop['w']), (int)round($crop['h']));
                try {
index 3bd58bb7681c5458920e8aba5111942a270143c4..f0e14ad8b2ff538ee27cc0c6512ba9c894a5b6fc 100644 (file)
@@ -38,7 +38,6 @@ namespace OC\Avatar;
 
 use Imagick;
 use OC\Color;
-use OC_Image;
 use OCP\Files\NotFoundException;
 use OCP\IAvatar;
 use Psr\Log\LoggerInterface;
@@ -106,7 +105,7 @@ abstract class Avatar implements IAvatar {
                        return false;
                }
 
-               $avatar = new OC_Image();
+               $avatar = new \OCP\Image();
                $avatar->loadFromData($file->getContent());
                return $avatar;
        }
@@ -148,7 +147,7 @@ abstract class Avatar implements IAvatar {
                        $avatar->setFont($font);
                        $avatar->readImageBlob($svg);
                        $avatar->setImageFormat('png');
-                       $image = new OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromData((string)$avatar);
                        $data = $image->data();
                        return $data === null ? false : $data;
index b46e4816fa29b39554614e12b5c53f337b6117f3..6cca5a1c35553c90a766f737b7030f72df9696c9 100644 (file)
@@ -31,7 +31,6 @@ namespace OC\Avatar;
 
 use OC\NotSquareException;
 use OC\User\User;
-use OC_Image;
 use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OCP\Files\SimpleFS\ISimpleFile;
@@ -130,7 +129,7 @@ class UserAvatar extends Avatar {
                        return $data;
                }
 
-               $img = new OC_Image();
+               $img = new \OCP\Image();
                if (
                        (is_resource($data) && get_resource_type($data) === 'gd') ||
                        (is_object($data) && get_class($data) === \GdImage::class)
@@ -279,7 +278,7 @@ class UserAvatar extends Avatar {
                                        $data = $this->generateAvatar($this->getDisplayName(), $size);
                                }
                        } else {
-                               $avatar = new OC_Image();
+                               $avatar = new \OCP\Image();
                                $file = $this->folder->getFile('avatar.' . $ext);
                                $avatar->loadFromData($file->getContent());
                                $avatar->resize($size);
index f7c8cf3543bffc5c4c26882482a86f7bf7ad493f..ffe5bc88856cee2f1f5106836efbb35a38604210 100644 (file)
@@ -68,7 +68,7 @@ abstract class Bitmap extends ProviderV2 {
                $this->cleanTmpFiles();
 
                //new bitmap image object
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData((string) $bp);
                //check if image object is valid
                return $image->valid() ? $image : null;
index 063c69ba5dd78e769b8703acb4f341daccd71a9a..df7f630dff71f2507daef7784e0415b184fbe7aa 100644 (file)
@@ -43,7 +43,7 @@ abstract class Bundled extends ProviderV2 {
                        $zip = new ZIP($sourceTmp);
                        $zip->extractFile($path, $targetTmp);
 
-                       $image = new \OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromFile($targetTmp);
                        $image->fixOrientation();
 
index d52191544f35d9e3d6118f0733d50cb97857d223..ef44188da74da8ff624ff958f37a40360a5ec8bd 100644 (file)
@@ -217,7 +217,7 @@ class Generator {
 
                // 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 \OC_Image) {
+               if ($maxPreviewImage instanceof \OCP\Image) {
                        $maxPreviewImage->destroy();
                }
 
index 7ce6b93ba3b1c5cc5fa2ca4c7d8eb4901bdf80df..ec200defce86fdbd43e0f4a3ce9f3a95c6470d6f 100644 (file)
@@ -89,7 +89,7 @@ class HEIC extends ProviderV2 {
                $this->cleanTmpFiles();
 
                //new bitmap image object
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData((string) $bp);
                //check if image object is valid
                return $image->valid() ? $image : null;
index 4bf0cb7a3d4e40eb5f1690f68f7be6ed97e6547f..55e1220b56a37c36533db225f444e6ff42284e06 100644 (file)
@@ -45,7 +45,7 @@ abstract class Image extends ProviderV2 {
                        return null;
                }
 
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
 
                $fileName = $this->getLocalFile($file);
 
index dec838b6e5a0c482d283890b674043505c1edd46..47d752af4771bf1869756fb40e07c024330fff43 100644 (file)
@@ -56,7 +56,7 @@ class MP3 extends ProviderV2 {
                }
 
                if (!is_null($picture)) {
-                       $image = new \OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromData($picture);
 
                        if ($image->valid()) {
index 929f319f57d4e2c022ae4c03b6fd61abf82921cb..d3806ce6c0ec09a7f31077fabb2bc96ecf08e43d 100644 (file)
@@ -137,7 +137,7 @@ class MarkDown extends TXT {
                        }
                }
 
-               $imageObject = new \OC_Image();
+               $imageObject = new \OCP\Image();
                $imageObject->setResource($image);
 
                return $imageObject->valid() ? $imageObject : null;
index 781cbad1954cf2bdb6ab457f76e98369687026bd..5cb66a00881d750a074771935ec8c6abb6cecaff 100644 (file)
@@ -145,7 +145,7 @@ class Movie extends ProviderV2 {
                exec($cmd, $output, $returnCode);
 
                if ($returnCode === 0) {
-                       $image = new \OC_Image();
+                       $image = new \OCP\Image();
                        $image->loadFromFile($tmpPath);
                        if ($image->valid()) {
                                unlink($tmpPath);
index 570988aa684fb08512a53783fe80720c47f41d9e..6717584e8877a66d90e99b1f8b651125ef0dff07 100644 (file)
@@ -83,7 +83,7 @@ abstract class Office extends ProviderV2 {
                        return null;
                }
 
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData((string) $png);
 
                $this->cleanTmpFiles();
index a4ce4899c43d267b6305a4556fa354ff1d7d0679..fd472083533383c63706614234eccc772502aa23 100644 (file)
@@ -68,7 +68,7 @@ class SVG extends ProviderV2 {
                }
 
                //new image object
-               $image = new \OC_Image();
+               $image = new \OCP\Image();
                $image->loadFromData((string) $svg);
                //check if image object is valid
                if ($image->valid()) {
index bb3af6b90de7917b843f83020aa7488436b1f420..f5a68f92be4cd5a9b5dcf92ee984a693aaa30a98 100644 (file)
@@ -103,7 +103,7 @@ class TXT extends ProviderV2 {
                        }
                }
 
-               $imageObject = new \OC_Image();
+               $imageObject = new \OCP\Image();
                $imageObject->setResource($image);
 
                return $imageObject->valid() ? $imageObject : null;