On Sunday, May 11, 2014 6:09:58 PM UTC+2, heavyKevy wrote:
>
> I have questions about the handling of images in Cake3.
>
> 1.  Having taken the upload plugin and worked on modifying it to work with 
> Cake 3, I have discovered that the data passed in the events make it 
> difficult to process files due to the name of the field not being passed 
> along:  Should the data be passed along differently if the field is a file 
> array so that the name of the field is passed along also?
>

I'm not sure what you mean with this, where is the name of the field not 
passed along? 

>
> 2.  In that there is no AfterFind event, what is the recommendation for 
> handling db stored files in order to display them in a view?  If only a 
> filename is stored, then how will the model fill in the path before the 
> data is passed along to the view?  Or should the whole webpath be saved in 
> the db?
>
>
You can use Entity getters for altering data:

class Article extends Entity {

    public function getImagePath() {
      return '/'  . $this->image . '.jpg'; // Just an example of what it 
could return
    }

}

echo $article->imagePath;

3.  Is making automatic file handling an option with the new ORM?
>

You could create a behavior an a Trait for entities to make the automatic 
file handling.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to