Pylons / deform

A Python HTML form library.
Other
416 stars 160 forks source link

Show preview of image in FileUploadWidget? #526

Open ITChick2018 opened 1 year ago

ITChick2018 commented 1 year ago

I'm a newbie in programming and can't find any helpful documentation for my problem... I want to use deform in my pyramid app. I used the FileUploadWidget to save my images in db. This works fine, but i can't figured out how I can show a preview of the uploaded image (eg in edit form).

Can you help me, or give me a hint for my problem?

thx :)

stevepiercy commented 1 year ago

Do you want to preview the image after you select it but before you submit the form, or do you want to preview it after you submit the form?

Deform does not do the former. You would need to use another tool and integrate it into a custom file upload widget, such as https://blueimp.github.io/jQuery-File-Upload/.

For the latter, you would need to retrieve the image (or its information) from the database, and render it in your template, again by creating a custom widget.

Sorry, I do not have an example of either at hand. It is left as an exercise for the developer. You can also post to the pylons-discuss Google group or Stack Overflow, per our General Support policy.

ITChick2018 commented 1 year ago

Thanks for your help. I want to show a preview before and after submit. I try to write a custom widget.

ITChick2018 commented 1 year ago

One more question? how to use the preview_url?

stevepiercy commented 1 year ago

I have no idea what is preview_url.