Steps necessary to store an image.

@param ImagesContainerWithPrincipalImageInterface $imageContainer Image Container
@param string                                     $imageName      Image name

@return $this Self object
501696
protected function storeProductImage(
        ImagesContainerWithPrincipalImageInterface $imageContainer,
        $imageName
    ) {
        $imagePath = realpath(__DIR__ . '/../images/' . $imageName);
        $image = $this->storeImage($imagePath);

        $imageContainer->addImage($image);
        $imageContainer->setPrincipalImage($image);

        return $this;
    }
339655
public function image($image = null)
    {
        if (null === $image) {
            return $this->image;
        }

        $this->image = $image;

        return $this;
    }
308925
public function setImageManager(ImageManager $imageManager = null, array $config = [])
    {
        if (!$imageManager) {
            $imageManager = new ImageManager($config);
        }
        $this->imageManager = $imageManager;

        return $this;
    }
1250934
public function saveImage(FileCreateOrUpdateEvent $event, FileModelInterface $imageModel)
    {
        return $this->saveFile($event->getParentId(), $imageModel);
    }
384651
public static function load(string $fileName, ImageDriver $driver = null): self
    {
        $self = new self($fileName, $driver);
        $self->handle = $self->driver->load($fileName);
        return $self;
    }
1372442
public function selectMainImage(Image $image)
    {
        if (!$this->images->findImageByUUID($image->getMediaObjectId())) {
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
        }

        $oldMainImage = $this->images->getMain();

        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
            $this->apply(
                $this->createMainImageSelectedEvent($image)
            );
        }
    }
458000
public function deleteImageByName($filename)
    {
        $destinationPath = $this->getDestinationPath();

        $images = $this->getImages();

        foreach ($images as $key => $image) {
            if ($image->file == $filename) {
                foreach ($image->set as $imageSetFilename) {
                    $destination = $destinationPath . '/' . $imageSetFilename;
                    if (file_exists($destination)) {
                        unlink($destination);
                    }
                }
                unset($images[$key]);
            }
        }
        $images = array_values($images);
        $this->repository->images = $images;
        $this->save();
    }
189956
public function createContainer($containerName, CreateContainerOptions $options = null)
    {
        $this->init();

        if (null === $options) {
            $options = $this->getCreateContainerOptions();
        }

        try {
            $this->blobProxy->createContainer($containerName, $options);
        } catch (ServiceException $e) {
            $errorCode = $this->getErrorCodeFromServiceException($e);

            if ($errorCode !== self::ERROR_CONTAINER_ALREADY_EXISTS) {
                throw new \RuntimeException(sprintf(
                    'Failed to create the configured container "%s": %s (%s).',
                    $containerName,
                    $e->getErrorText(),
                    $errorCode
                ));
            }
        }
    }
771763
public function createImageResource($keepHandleAlive = false): ImageResource {
		$resource = IoUtils::imageCreateFromPng($this->filePath);
		
		imagealphablending($resource, false);
		
		return new ImageResource($resource, $keepHandleAlive);
	}
147716
public function storeTemporaryImage (Image $image)
    {
        $json = $this->storeGenericMedia(MediaType::IMAGE, false, $image);

        return (new Uploaded\Image($json->media_id))
            ->withExpiresDate($this->createExpiryDate($json->created_at));
    }
1312038
public function useImageDriver(string $imageDriver)
    {
        if (! in_array($imageDriver, ['gd', 'imagick'])) {
            throw InvalidImageDriver::driver($imageDriver);
        }

        $this->imageDriver = $imageDriver;

        InterventionImage::configure([
            'driver' => $this->imageDriver,
        ]);

        return $this;
    }
1030537
public static function fromResource($resource) {
        $newImage = new self();
        try {
            $newImage->setResource($resource);
        } catch(\Exception $e) {
            throw new ImageException($e->getMessage(), ImageException::UnsupportedFormatException, $e);
        }
        return $newImage;
    }
79760
public function getImageField($imageFieldName)
    {
        $imageFields = $this->getImageFields();

        return isset($imageFields[$imageFieldName]) ? $imageFields[$imageFieldName] : null;
    }
652918
public function store(string $fileName, $handle): ImageDriver
    {
        $this->lastStoredFileName = $fileName;
        $this->lastStoredHandle   = $handle;
        return $this;
    }
840412
final public function saveImage($filename)
	{
		$extension = pathinfo($filename, PATHINFO_EXTENSION);

		if (! is_string($extension)) {
			$extension = image_type_to_extension($this->_image_type);
			$filename .= ".{$extension}";
		}

		switch(strtolower($extension))
		{
			case 'jpeg':
			case 'jpg':
				return $this->imageJPEG($filename);
				break;

			case 'png':
				return $this->imagePNG($filename);
				break;

			case 'gif':
				return $this->imageGIF($filename);

			default:
				trigger_error('Invalid extension or not an image', E_USER_WARNING);
				return false;
		}
	}
1175371
public function create(int $width, int $height): self
    {
        $this->width = $width;
        $this->height = $height;
        $imageData = imagecreatetruecolor($this->width, $this->height);
        if (false === $imageData) {
            throw new ImageException('Unable to create new image!');
        }
        $this->workingData = $imageData;
        if (self::FORMAT_PNG === $this->extension) {
            $this->setTransparency(false, true);
        }
        if (self::FORMAT_GIF === $this->extension) {
            $this->setTransparency();
        }
        $this->encrypted = false;
        return $this;
    }
1298672
public function image() {
        $this->check_role = 'image';
        if ($this->value instanceof File) {
            $result = in_array($this->getImageType($this->value->path_tmp), [1, 2, 3, 6]);
        } else {
            $result = in_array($this->getImageType($this->value), [1, 2, 3, 6]);
        }
        $this->checkResult($result);
        return $this;
    }