Thumbs.destination usage in 2.1.0

I tried to use the new thumbs.destination function in the 2.1 beta & now the released 2.1.0.

I’ve tried to return a path (folder name, relative path, etc) but I get a “Trying to get property of non-object” error when I use it.

I’m not entirely sure how to use the callback function to set the destination. Also, can this be used on a per-case basis or can it only be set in the config file to override the global thumbs destination?


You may need to post your code. If the error is “Trying to get property of non-object”, then I suspect you are trying to use a variable you expect to be instantiated that isn’t. For example $site, $page, etc will not be possible to use in your callback. If you are just returning a path, then it shouldn’t be possible for you to get this error, since a path is just a string.

Thanks @walkerbox, I guess that’s my issue. I don’t know WHAT to put in the code to actually change the destination of the thumbs.

The code from the changelog is:

c::set('thumbs.destination', function($thumb) {
  // return a path here where the thumbnail should be stored    

So I’m trying to figure out to include something there and still successfully call the thumb function on a template. Also wondering if this can be changed dynamically or just once through the config file.