I created a form using the Form API, with a plupload field. How can I display a thumbnail, and allow the user to set a label and specify an alt field for an image?

Comments

gkom’s picture

Here's an outline of the process:

1. Enable FileField Sources + FileField Sources Plupload modules.
2. Add/edit an image field.
3. In the field configuration form set your desirable options including:

  • Enable Alt field
  • Enable Title field
  • Preview image style (for the thumbnail in edit form)
  • Enable the "Advanced upload widget (Plupload)"
  • Optional: Enable "insert" button so you can insert the images to the body. This will only be available if the you install the "insert module".

Hope this helps.

vintorg’s picture

Hi gkom,

I missed your reply :-(

I don't understand where I set a preview image style for the thumbnail. Is that a value I set for the form plupload element?

Thanks!

gkom’s picture

Reading your question again I realised that I misunderstood you the first time.
The instructions I gave you were for setting the options via the node edit form gui. Sorry about that.

Unfortunately, I have never built a custom form with a similar field so I can't really give you exact instructions.

In theory, you should create the alt and title fields programmatically. Perhaps looking at the code in the patches submitted on the following page can help: https://drupal.org/node/1307054#comment-6791808

iseeaflyingcrane’s picture

Issue summary: View changes

Hi vintorg,

now 5 years have passed, i wonder if you firgured out how to show thumbnail while using plupload on a custom form? I am facing the same problem. thank you!