Make image upload handling easier

(Tailormade) #1

I just came across image uploading and displaying. I used Kartiks fileInput widget ( which is already helpful. Also the UploadedFile class is already helpful.

Still I hate it. There’s so much code with uploading files and it is always the same mess. Especially with images. But I think it could be simpler if the framework supports it somehow.

Thing about an avatar or so. Often there is an image that needs to be managed by a user. If you want to implement it you have to code a lot. For creation, updating and deletion. Always the same thing. The file has to be stored somehwere or deleted or replaced. A field for a file name is required in a db table and you need something for the view (widget) for managing or viewing.

Aren’t there many projects that needs that? I think so. So it would be quite helpful if the Yii framework could provide more support to handle this.

Maybe the ActiveRecord needs something. Or a Behaviour could help. What do you think? Does that make sense? Just think about how a developer could realize an avatar easily in his or her project.

It is not the same but for example the Yii app templates are also really, really helpful for the whole login/account stuff. I’m quite happy that this is already there and I don’t have to implement this for each project by myself. And the avatar thing is somehow similar: a (of course less) complex functionality that has to be coded with each occurence. I would be happy if there would be something in the framework that makes life easier.

So if you just have nothing to do … ;) think about it and make some comment please!