src/Silvestra/Component/Media/Image/ImageUploader.php
public function createImage(UploadedFile $uploadedImage)
    {
        $image = $this->imageManager->create();
        $filename = $this->getUniqueFilename($uploadedImage);

        $image->setFilename($filename);
        $image->setMimeType($uploadedImage->getClientMimeType());
        $image->setOrderNr(1);
        $image->setOriginalPath($this->filesystem->getRelativeFilePath($filename));
        $image->setPath($image->getOriginalPath());
        $image->setSize($uploadedImage->getClientSize());
        $image->setTemporary(true);

        $this->imageManager->add($image);

        $fileDir = $this->filesystem->getActualFileDir($filename);

        $uploadedImage->move($fileDir, $image->getFilename());

        return $image;
    }
public function createImage(UploadedFile $uploadedImage)
    {
        $image = $this->imageManager->create();
        $filename = $this->getUniqueFilename($uploadedImage);

        $image->setFilename($filename);
        $image->setMimeType($uploadedImage->getClientMimeType());
        $image->setOrderNr(1);
        $image->setOriginalPath($this->filesystem->getRelativeFilePath($filename));
        $image->setPath($image->getOriginalPath());
        $image->setSize($uploadedImage->getClientSize());
        $image->setTemporary(true);

        $this->imageManager->add($image);

        $fileDir = $this->filesystem->getActualFileDir($filename);

        $uploadedImage->move($fileDir, $image->getFilename());

        return $image;
    }
public function createImage ( UploadedFile $ uploadedImage ) { $ image = $ this -> imageManager -> create ( ) ; $ filename = $ this -> getUniqueFilename ( $ uploadedImage ) ; $ image -> setFilename ( $ filename ) ; $ image -> setMimeType ( $ uploadedImage -> getClientMimeType ( ) ) ; $ image -> setOrderNr ( 1 ) ; $ image -> setOriginalPath ( $ this -> filesystem -> getRelativeFilePath ( $ filename ) ) ; $ image -> setPath ( $ image -> getOriginalPath ( ) ) ; $ image -> setSize ( $ uploadedImage -> getClientSize ( ) ) ; $ image -> setTemporary ( true ) ; $ this -> imageManager -> add ( $ image ) ; $ fileDir = $ this -> filesystem -> getActualFileDir ( $ filename ) ; $ uploadedImage -> move ( $ fileDir , $ image -> getFilename ( ) ) ; return $ image ; }
Create image.

@param UploadedFile $uploadedImage

@return ImageInterface
Create image .