CTOlet / yii2-attachments

Yii2 extension for uploading and attaching the files to the models
66 stars 57 forks source link

Add image caption, title, alt, and other html attribute support #7

Closed larry-tx closed 8 years ago

larry-tx commented 9 years ago

First, let me congratulate you on an excellent extension. Kartik's File Input widget provides a lot of functionality, but it is somewhat of a pain to set up and use, especially if you have a lot of models that use attachments and you have multiple attachments on each model. Your extension makes all that a breeze.

If you're ever inclined to enhance the extension, I'd like to suggest that you consider a way to add "title" and "alt" for each attachment. Those are important attributes for for attachments (whether they're images or files such as PDFs, etc.). With those enhancements, your extension would really rock!

CTOlet commented 9 years ago

Ok, thank you! That is really good idea. I will think about the solution on my free time.

maxxer commented 9 years ago

@LarryTX could you please change the subject to something meaningful, like Add image caption support or something like that? thanks

@Nemmo I'm trying to implement this, but I'm having some troubles... I found the way to customize the upload preview template to include a text field, but then I have no idea on how to associate this textfield to the uploaded file. If I got it right you upload the files using the controller and save them in the behavior, but there's no information exchanged between the two. I found I can POST the text field using file-input's uploadextradata method, but I'm missing how to transfer this info from the FileController->actionUpload method to the Module's attachFile, where the DB is updated... If you have any idea it will be welcome. thanks

maxxer commented 9 years ago

I made some work on this issue on a forked branch here. Sadly it's not fully working and I'm lacking time to further fix the remaining (non trivial) issues. But could be a starting point, if someone else has more time/ideas. I made a long commit message stating the situation.

Sorry but the commit includes stuff from other branches