Skip to content

Conversation

@jonny-no1
Copy link
Contributor

As previously brought up, please consider my implementation attempt of the Convert annotation

// ...
use Snowcap\ImBundle\Doctrine\Mapping as SnowcapIm;
// ...

  /**
   *
   * @Assert\File(maxSize="6000000")
   * @SnowcapIm\Convert(params={"thumbnail"="100x100>"}, targetProperty="thumbnail")
   */
  public $file;

  public $thumbnail;

as well as the ConvertMultiple annotation

// ...
use Snowcap\ImBundle\Doctrine\Mapping as SnowcapIm;
// ...

  /**
   *
   * @Assert\File(maxSize="6000000")
   * @SnowcapIm\Mogrify(params={"resize"="1024"})
   * @SnowcapIm\ConvertMultiple({
   *     @SnowcapIm\Convert(params={"resize"="612"}, targetProperty="medium"),
   *     @SnowcapIm\Convert(params={"thumbnail"="100x100>"}, targetProperty="thumbnail")
   * })
   */
  public $file;

  public $medium;

  public $thumbnail;

I am almost there, but I am struggling in the last step because the convert method of the Manager class only allows paths relative to the web root for the input file. I am currently uncertain as to a good solution to this problem and would be thankful for any suggestions.

@jonny-no1 jonny-no1 changed the title Annotations Convert and ConvertMutliple Annotations Convert and ConvertMultiple Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant