Custom Form to Upload User Picture Drupal 7
Past cesarpo on
I've been looking at the FAPI reference and didn't found the image upload widget command, there is simply a #file and a #managed_file, I've been using the #managed_file, but i'de like the thumb preview functionality.
thanks!
Source: https://www.drupal.org/forum/support/module-development-and-code-questions/2011-01-27/how-to-use-image-upload-widget-in-a
Comments
I am searching for the same
I am searching for the aforementioned solution, although in D6. I found some tutorials for d6, just all of them adivised to copy imagefield widget from some cck field. I don't think it is good solution. I don't want my class field to be depent on some cck field.
Need it too!!!
I'm searching for that as well!!!
Do y'all know how to populate the images' information in a table?! I would like to do something similar to the paradigm upload form.
Any ideas?
I'one thousand looking for the aforementioned ..
lukus
commented
I'm looking for the aforementioned .. will report back when I find a solution.
EDIT: Briefly, the solution I came up with (for Drupal 7) is as follows:
eg. add something like this to your theme array...
eg.
eg.
If all you lot demand is to mimic
djg_tram commented
If all y'all need is to mimic the cadre style then, actually, there is no need to roll your own theme part. Fix the
managed_file
as this:You don't need the
#fastened
item if yous don't want the preview to appear floating to the left or you have included the necessary CSS into your own style already.That solution doesn't piece of work
derMatze commented
That solution doesn't work for me...
Anyone who has a solution for this event? It would be great if one could use the normale _multiple_ paradigm upload inside form api.
When you lot say it doesn't work
When you say information technology doesn't work for y'all, what do y'all mean? Do you get an error? Do y'all become something, but not what you expected? Can y'all provide examples of your code, or screenshots?
I but get the normal one
derMatze commented
I just become the normal ane file upload form item, that I get when I don't apply
'#theme' => 'image_widget'
for that item...
No errors, only there is no difference.
I have work example
mozh92 commented
I have work instance
It works, Thanks a lot!
dks786 commented
Hey Thank you Aleksey for your code, Information technology works very well.
I am able to upload prototype and tin see the image thumbnail.
But when I refresh that page, the image volition gone,
What I need to do for display that image (when refresh the page, later upload) until i delete it.
You tin salve image in hook
mozh92 commented
You tin salve image in hook_submit_form
im my example, I save epitome in node
change name 'user_identity' on own
Thank you a lot again!
dks786 commented
I am using currently - render system_settings_form($class);
And so exercise I need to use submit button lawmaking Instead of that?
Or If you know what to use with system_settings_form, than please guide me!
Thanks my love :) I attempt this code.
Following code works for me, promise it helps someone
drupalastic commented
// in from builder function
// managed file elements process callback
// elements pre render callback
Our forum is swell identify for
dks786 commented
Our forum is not bad identify for drupal discussion, sharing knowledge, gaining data, solving trouble, exploring drupal...etc.
This is the great & vast network of drupal developers.
if this is outdated than where should we discuss, please advise!
The community is great - it's
Jaypan commented
The customs is great - it's the bodily forum software that sucks.
Here is ok, but you're more likely to detect an answer on drupal.stackexchange.com, due to them having a modern software that properly handles programming style questions.
Thank you mmjvb,
dks786 commented
Thanks mmjvb,
But in my opinion, rather than many groups, The one vast group is meliorate. then on the same place we can meet with all experts.
that'due south why i was preferred the drupal.org grouping. (all people on same identify to hash out, and not need to post/search on unlike-2 communities)
Not sure what you are talking about, sounds off topic!
mmjvb commented
Anyway, you lot are not going to meat too many experts here. Which is why I pointed to slack, non saying not to use the forum!
Suggest to run across the documentation on where to find the community, there are more places and then are mentioned here.
Thanks for the feedback
drupalastic commented
@Jaypan, Glad to know that y'all liked it :) & thanks for the positive feedback.. My Salutes to your contributions in Drupal :).... I wish i can too contribute back to the customs, at-to the lowest degree a small percentage of what y'all take done...