Posted by katerega on February 2, 2017 at 6:49am
Am trying to display a profile image submitted by a webform on registration but cant figure out how to do it. i can display a static image but can't display image submmitted by the form. anyone know any module or code that does that, thanks, coz have been looking for it for a week now

Comments
It's not hard to do with the
It's not hard to do with the profile 2 module, however you can check this out https://www.drupal.org/project/reg_with_pic
Hi Cavin, can the photo
Hi Cavin, can the photo upload be displayed separately from the initial registration? coz i failed to filed a way of splitting them that's why i resorted to using webform to do the registration since it was giving me a lot of flexibility in display as i wanted. please if there is any way the pgoto upload can be on a separate page from that of registration let me know. coz i failed to separate it
clarity...
Are you using webforms (the module) to register users?
Or are you talking of the default Drupal user registration form?
How and where do you want to display this image? Is it in a tpl file? Views?
i extended the default drupal
i extended the default drupal user registration form to use webform to register due to the requirements i wanted. I want to display the image in the tpl file using a block
Use Views
Just use views to display what ever you are displaying. views has helped me display almost anything i ever wanted to display.
Unfortunately, views wont
Unfortunately, views wont display data from Webforms module. Thats if he is using that module. Otherwise if its the default forms, that should help.
webform submitted content viewing
Am using webforms with data table module and sqlviews module, so am using the web form module to register a new user but i want to display a photo that is uploaded on registration on the home page using a block am trying to use the db_select() function, any ideas how i can do it or any better way STEP BY STEP on how to display photo uploaded via a webform. thanks
First steps ...
Hello katerega,
First question ... have you been able to attach the uploaded image to its user using this method?
If so, then we can proceed to how you can access the image?
yes Matovu, when i register a
yes Matovu, when i register a user using the webform, the submission in the database shows that a photo is attached to the user and its stored in the default/image/file directory and with a unique uri url stored in the table drfa_file_managed
Hi Peter, i tried views but
Hi Peter, i tried views but they don't show the profile image dynamically, maybe if u have a step by step how to. on how to use the views to show a logged in user details. they show the username but without use photo
my code in the custom module
my code in the custom module looks something like this,
function MBlock_block_view($delta = '') {
$uid = "150";
$result = db_query('SELECT n.uri FROM drfa_file_managed n WHERE n.uid = :uid', array(':uid' => $uid));
$block['content'] = t(' @host ',array(
'@user' => format_username($user),
foreach ($result as $record) {
'@photouri' => $result->fetchColumn(0);
// echo ";";
}
));
return $block;
}
anywhere am going wrong, please i stand to be corrected.
this function is supposed to get me the url for the photo so that the block can display the photo dynamically from the database basing on the logged in user thanks
Feedback ...
Hey katerega,
This is what I think.
Your approach seems flawed. The UID field in the file_managed table only indicates who uploaded the image.
With this approach and in case you allow your users to upload more images, your query will return ALL the images uploaded by a user.
In this situation, how will you:
But nevertheless, if you still wish to continue down this path, what I would change in your code is as below.
Please keep in mind that this is untested and I do not recommend this approach one bit.
I would recommend the approach suggested by cavinm (reg_with_pic module) or the Profile module.
/
* this line returns the actual URI
* ... I think! Test!
*/
$result->fetchColumn(0)
/
* you need to convert that URI into an image
* ... something like this, again TEST and check.
*/
echo '<img src="' . file_create_url($result->fetchColumn(0)) . " />';
There is a thread
There is a thread here: https://www.drupal.org/node/1977118
I think you'll find something there.