-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added PasteFilterLoader #118
Conversation
public function load(ImageInterface $image, array $options = array()) | ||
{ | ||
list($x, $y) = $options['start']; | ||
$destImage = $this->imagine->open($this->rootPath.'/../'.$options['image']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the path altered here with /../
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kernel.root_dir
points to app/
. I figured it'd be more practical if the image path was relative to the project root directory instead of the kernel root directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you should pass the correct directory directly.
If one would use another directory (you may have a completely different directory structure in your project) it will be annoying that the directory is changed this way. For example I would like to have that image being generated into a temp directory as I will upload it to Amazon S3 afterwards and delete the temporary file.
@havvg - good point. Fixed. |
can you also add a note to the README? |
Will it works with negative offsets? |
ping .. |
public function load(ImageInterface $image, array $options = array()) | ||
{ | ||
list($x, $y) = $options['start']; | ||
$destImage = $this->imagine->open($this->rootPath.'/'.$options['image']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about checking whether the $options['image']
is already an Imagine\Image\ImageInterface
and use this directly? If it's not, the current line is just fine.
Thank you! |
Added a filter loader for the 'Paste' filter. I really think there ought to be loaders for all the in-built Imagine filters so everything works out the box.
Example configuration for adding a watermark to an image: