return default Image or LocalFile Object.

@return \AvoRed\Framework\Image\LocalFile
420794
public function getImageAttribute()
    {
        $defaultPath = '/img/default-product.jpg';
        $image = $this->images()->where('is_main_image', '=', 1)->first();

        if (null === $image) {
            return new LocalFile($defaultPath);
        }

        if ($image->path instanceof LocalFile) {
            return $image->path;
        }
    }
1221587
public static function get_random_local_image()
    {
        self::install_mock_files();
        return self::get_mock_files()->sort(DB::get_conn()->random())->first();
    }
413783
public function getFile(): ?Filesystem
    {
        if (!$this->hasFile()) {
            $this->setFile($this->getDefaultFile());
        }
        return $this->file;
    }
769002
public function getOriginalImage()
    {
        if ($this->_originalImage == null) {
            $this->_originalImage = Yii::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $this->getUser()->id . '_avatar.jpg';
        }
        return $this->_originalImage;
    }
1098112
public static function generate_no_image()
    {
        // See if the image is already in the DB
        $no_image = "no-image.png";
        $image = File::find($no_image);

        // If not, create new record
        if (!isset($image)) {
            $reflector = new ReflectionClass(self::class);
            $curr_file = dirname($reflector->getFileName());
            $curr_file = str_replace(
                "src/helpers",
                "client/dist/images/no-image.png",
                $curr_file
            );

            $config = array(
                'conflict' => AssetStore::CONFLICT_OVERWRITE,
                'visibility' => AssetStore::VISIBILITY_PUBLIC
            );
            
            $image = Injector::inst()->create(Image::class);
            $image->setFromLocalFile(
                $curr_file,
                $no_image,
                null,
                null,
                $config
            );
            $image->write();
            $image->publishSingle();
        }

        return $image;
    }
166612
protected function image()
    {
        $locator = Grav::instance()['locator'];

        $file = $this->get('filepath');

        // Use existing cache folder or if it doesn't exist, create it.
        $cacheDir = $locator->findResource('cache://images', true) ?: $locator->findResource('cache://images', true, true);

        // Make sure we free previous image.
        unset($this->image);

        $this->image = ImageFile::open($file)
            ->setCacheDir($cacheDir)
            ->setActualCacheDir($cacheDir)
            ->setPrettyName($this->getImagePrettyName());

        return $this;
    }
690660
protected function getResizedImageUrl()
    {
        $imageUrl = "";

        if ($this->getResizedImagePath()) {
            $imageUrl = $this->getImageDirUrl() . $this->getResizedImageName();
        }

        return $imageUrl;
    }
638440
public function SortedImages()
    {
        // If this product has images, display them
        if ($this->Images()->exists()) {
            return $this->Images()->Sort('SortOrder');
        }

        $config = SiteConfig::current_site_config();
        $default_image = $config->DefaultProductImage();
        $images = ArrayList::create();
        
        // Try to use default from SiteConfig, if none is available,
        // use a system default
        if ($default_image->exists()) {
            $image = $default_image;
        } else {
            $image = Helper::generate_no_image();
        }

        // Finally return a list with only the default
        $images->add($image);
        return $images;
    }
1374585
public function getFile()
    {
        if (is_null($this->file)) {
            $referencer = $this->getServiceLocator()->get(FileReferenceSerializer::SERVICE_ID);
            $this->file = $referencer->unserialize($this->getFileSerial());
        }
        return $this->file;
    }
729787
public function getThumbnailsFormat()
    {
        if ($this->thumbnailsFormat === null) {
            $this->setThumbnailsFormat($this->app->make('config')->get('concrete.misc.default_thumbnail_format'));
        }

        return $this->thumbnailsFormat;
    }
532654
public function getImageBlob()
    {
        if (!$this->processed) {
            return file_get_contents($this->source);
        }

        if ($this->isMultipartImage()) {

            $this->tmpFile = tempnam($this->tmp, 'jitim_');

            $image = $this->resource->deconstructImages();
            $image->writeImages($this->tmpFile, true);

            $image->clear();
            $image->destroy();

            return file_get_contents($this->tmpFile);

        }

        return $this->resource->getImageBlob();
    }
147724
public function img()
    {
        // Check for an existing Image relation
        if (($image = $this->parentImg($this->inputName()))
            && $image->exists) {

            // If the Image represents a default image, but doesn't match the current
            // item from the config, trash the current one and build the new default
            // image.
            if ($replacement = $this->getReplacementImage($image)) {
                return $replacement;
            }

            // Return the found image
            return $image;
        }

        // Else return a default image
        return $this->defaultImage();
    }
831855
public function Image()
    {
        if ($this->ActionImage()) {
            return $this->ActionImage();
        }
        if ($this->Type == 'SiteTree') {
            return $this->SiteTree()->ActionImage();
        }
    }
185461
public function getImageDetails() {
		//set default return
		$return = ['width' => 0, 'height' => 0, 'size' => 0];
		//set media path
		$sMediaPath = \Yii::$app->imagemanager->mediaPath;
		$sFileExtension = pathinfo($this->fileName, PATHINFO_EXTENSION);
		//get image file path
		$sImageFilePath = $sMediaPath . '/' . $this->id . '_' . $this->fileHash . '.' . $sFileExtension;
		//check file exists
		if (file_exists($sImageFilePath)) {
			$aImageDimension = getimagesize($sImageFilePath);
			$return['width'] = isset($aImageDimension[0]) ? $aImageDimension[0] : 0;
			$return['height'] = isset($aImageDimension[1]) ? $aImageDimension[1] : 0;
			$return['size'] = Yii::$app->formatter->asShortSize(filesize($sImageFilePath), 2);
		}
		return $return;
	}
1135766
public function src()
    {
        $src = $this->thumbnail();

        if (!$src) {
            $src = $this->file();
        }

        return $this->createAbsoluteUrl($src);
    }
825686
public function defaultImage()
    {
        // Return an empty Image object if no default value
        if (empty($this->value)) {
            return new Image;
        }

        // All src images must live in the /img (relative) directory
        if (!Str::is('/img/*', $this->value)) {
            $msg = 'Element images must be stored in public/img: '.$this->value;
            throw new Exception($msg);
        }

        // Check if the image already exists in the uploads directory
        $src = $this->value;
        $src_abs = public_path($src);
        $path = str_replace('/img/', '/elements/', $src);
        if (!app('upchuck.disk')->has($path)) {

            // Copy it to the disk
            $stream = fopen($src_abs, 'r+');
            app('upchuck.disk')->writeStream($path, $stream);
            fclose($stream);
        }

        // Wrap the touching of the element and images table in a transaction
        // so that the element isn't updated if the images write fails
        DB::beginTransaction();

        // Update or create this Element instance
        $this->value = app('upchuck')->url($path);
        $this->save();

        // Create and return new Image instance. The Image::populateFileMeta()
        // requires an UploadedFile, so we need to do it manually here.
        $size = getimagesize($src_abs);
        $image = new Image([
            'file' => $this->value,
            'name' => $this->inputName(),
            'file_type' => pathinfo($src_abs, PATHINFO_EXTENSION),
            'file_size' => filesize($src_abs),
            'width'     => $size[0],
            'height'    => $size[1],
        ]);
        $this->images()->save($image);
        DB::commit();

        // Clear cached image relations
        unset($this->relations['images']);

        // Return the image
        return $image;
    }
1061365
public function getFileResource()
    {
        $app = Application::getFacadeApplication();
        $cf = $app->make('helper/concrete/file');
        $fs = $this->getFile()->getFileStorageLocationObject()->getFileSystemObject();
        $fo = $fs->get($cf->prefix($this->fvPrefix, $this->fvFilename));

        return $fo;
    }