On Fri, May 30, 2008 at 9:57 PM, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote: > >> I certainly don't think this should be in the model though (or even a >> behavior). Maybe a helper would make sense if you were serving up >> different sizes based on the user's request. > > Why? > > If he is modeling the Image, maybe is because it's a important concept > for his application and must be considered data int that context, thus > having data manipulation code in the model is the right approach.
Sure, i can understand having an Image model. I just don't feel that it's the correct place for *manipulation* code. > If you are in the need for having various sizes, depending on the view > then consider this: > > * An Image model having the true resizing logic. I disagree. Variables for the default size, as a string or int, sure. > * An Images controller with it's custom routes so having i.e. > /img/user/5/50x30/avatar.jpg dispatching to a resize method in your > images controller that parses the URL, finds and resizes the image and > then stores it under the requested path so, next time it's fetched > from webroot. Agreed. > * An Image helper encapsulating the resizing logic so you can do in > views: echo $image->resize($user['image'], array( 'size' => '50x30')); This is what i meant by having some helper logic. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---