Forums

Image send by user has to be displayed in the form (email template)

Repitol 17 Jul, 2014
Hi !
I need to display in a specific zone on my email template, the image send by the user
I searched in the forum but didn't find the solution for that (if possible).

User can send 1 image while filling the form
he also needs to receive the corresponding email with the image at the right place in the email template
please help me transFORMers !๐Ÿ˜‰
regards
chronoben 17 Jul, 2014
Hahaha, I am answering this because I get to be a "transFORMer".

Do this, in the email you send simply attach the URL of the image.

TO know where your image is after form submission use a "Debugger" to find the variable holding the image name.
Then I suggest forming the image path in a "Custom Code".

$form->data['user_image_sent'] = JURI::root()."any_folder_I_specified_in_fileupload_plugin/".$form->data['file']['this_holds_image_path'];

Check your debugger for the right variable that holds the file path, not sure about $form->data['file']['this_holds_image_path']

The above code is not tested but that's how I would do it.
Amazing thing about Chronoforms is that there are a tonne of ways to do the same thing, some more elegant than others.

Cheers.
chronoben 17 Jul, 2014
Oops forgot to add, in the Email template portion simply place this where you want the image to appear

<img src"{user_image_sent}" alt="The image you sent bla bla bla " />
GreyHead 17 Jul, 2014
Hi Repitol,

I think that the uploaded file name is in the $form->data array; you know the upload folder so you can build a URL to include in an <img> tag in the email.

Beware that many Email readers don't automatically show images.

Bob
Repitol 17 Jul, 2014
Thanks for the answers !
I'll make some tests and report the results when done.

Repitol
This topic is locked and no more replies can be posted.