Skip to content
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

Feature Request: Getter method for Image->ressource #18

Closed
hetsch opened this issue Mar 24, 2011 · 4 comments
Closed

Feature Request: Getter method for Image->ressource #18

hetsch opened this issue Mar 24, 2011 · 4 comments

Comments

@hetsch
Copy link

hetsch commented Mar 24, 2011

Hi,
first thing - thanks for that beautiful library. I really appreciate to work with it.
There is one small question left for me:
If i try to make a FilterInterface to manipulate the color of an image like this:

class Color implements FilterInterface
{
    private $color;
    
    public function __construct($value)
    {
        $ratio = max($value, 255);
        
        $this->color = new \Imagine\Image\Color('fff');
        $this->color->darken($value);
    }
    
    public function apply(ImageInterface $image)
    {
        imagefilter($image->resource, IMG_FILTER_COLORIZE, 
            $this->color->getRed(), 
            $this->color->getGreen(), 
            $this->color->getBlue()
        );

        return $image;
    }
}

there is no way to get receive the resource of the image because it's a private property. I also
haven't found a getter method. So might it make sense to create a getter, or do I only have some heavy knots in my thoughts?

Thanks

@avalanche123
Copy link
Collaborator

For this kind of things, there will be effects api (think DrawerInterface),
which will define EffectInterface that each driver will implement.
The main goal of Imagine is to bring the different libraries PHP comes with
to a common interface,
so you would probably do something like the following when that API is
built:

return $image->effect()
    ->colorize($this->color);

On Thu, Mar 24, 2011 at 4:03 PM, hetsch <
reply@reply.github.com>wrote:

Hi,
first thing - thanks for that beautiful library. I really appreciate to
work with it.
There is one small question left for me:
If i try to make a FilterInterface to manipulate the color of an image like
this:

class Color implements FilterInterface
{
       private $color;

       public function __construct($value)
       {
               $ratio = max($value, 255);

               $this->color = new \Imagine\Image\Color('fff');
               $this->color->darken($value);
       }

       public function apply(ImageInterface $image)
       {
               return imagefilter($image->resource, IMG_FILTER_COLORIZE,
                       $this->color->getRed(),
                       $this->color->getGreen(),
                       $this->color->getBlue()
               );
       }
}

there is no way to get receive the resource of the image because it's a
private property. I also
haven't found a getter method. So might it make sense to create a getter,
or do I only have some heavy knots in my thoughts?

Thanks

Reply to this email directly or view it on GitHub:
#18

Bulat Shakirzyanov | Software Alchemist

a: *about.me/avalanche123
*e:
mallluhuct@gmail.com

@hetsch
Copy link
Author

hetsch commented Mar 24, 2011

Nice! So when can we expect that kind of thing? Is it planed to release it in the next few days/weeks or do we have to wait longer? (only roughly...). But anyway - thanks for your response

@avalanche123
Copy link
Collaborator

next couple of weeks, thanks for using it!

On Thu, Mar 24, 2011 at 4:51 PM, hetsch <
reply@reply.github.com>wrote:

Nice! So when can we expect that kind of thing? Is it planed to release it
in the next few days/weeks or do we have to wait longer? (only roughly...).
But anyway - thanks for your response

Reply to this email directly or view it on GitHub:
#18 (comment)

Bulat Shakirzyanov | Software Alchemist

a: *about.me/avalanche123
*e:
mallluhuct@gmail.com

@hetsch
Copy link
Author

hetsch commented Mar 24, 2011

Great!

@hetsch hetsch closed this as completed Mar 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants