Preferred Graphics Toolkit

tilted-kilt

Joined: 2008-09-06
Posts: 2
Posted: Sat, 2008-09-06 11:20

Short question: If I have two graphics toolkits enabled (that perform the same functions) how do I know which will be used?

Long version: I'm developing a Graphics Toolkit to utilise Mac OS X's CoreImage functionality. At the moment I'd just like to get the basics working (crop and resize). After testing it on my local system, I want to enable it on a low traffic Gallery just to make sure everything is working fine before continuing. But since everything isn't finished I'll want ImageMagick still enabled, but how do I make sure it uses my plugin for what it can do and only uses ImageMagick when it can't?

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Sat, 2008-09-06 11:24

When you register the toolkit plugin in the factory there's an (optional) priority, $orderWeight. When Gallery looks in the factory for a toolkit to handle your mime-type it picks the compatible one with the lowest weight.

http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryCoreApi.html#methodregisterFactoryImplementation

 
tilted-kilt

Joined: 2008-09-06
Posts: 2
Posted: Sat, 2008-09-06 11:42

Ah! Thanks very much. You saved me hours of head scratching. (The Gallery codebase is still very new to me, so I don't know where to find things)

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Sat, 2008-09-06 12:00

Actually it might be this one that's more signifcant for individual operations, priority-wise:

http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryCoreApi.html#methodregisterToolkitOperation