Post Image on template
-
When using post image with my website it doesnt show the image on the pdf (it just defaults to a red x instead).
The defualt template works just fine.
the code is shown below
<div style="width: 100%; overflow: hidden; background-color:#eaf1f9;"> <div style="width: 250px; float: left;"><b>Photo Evidence 1 </b> <br /> <img src="{Photo Evidence 1:77}" > </div> <div style="width: 200px; float: left;"><b>Photo Evidence 2</b> <br /> {Photo Evidence 2:78} </div> <div style="width: 200px; float: left;"><b>Photo Evidence 3</b> <br /> {Photo Evidence 3:79}</br> </div> </div>
-
Hi,
Some hosting providers have trouble showing images when using URLs in the PDF. In the default template we use an absolute path instead which is why it works in that template.
While there’s no absolute path merge tag you can instead use the
$form_dataarray to display your images:<?php $path = $form_data['field'][77]['path']; if( is_file( $path ) ): ?> <div style="width: 100%; overflow: hidden; background-color:#eaf1f9;"> <div style="width: 250px; float: left;"><b>Photo Evidence 1 </b> <br /> <img src="<?php echo $path; ?>" > </div> <?php endif; ?>Hi,
After trying your code the div seems to completely dissapear from the form results. Before hand adding &html=1 would display the image without an issue but now it seems to be gone entirely.
Any pointers?
That suggests the
is_file()check failed so the entire container doesn’t show up. You can remove that if statement if you want but you would still see a red X in place of the image.If you add
&data=1to the URL when viewing the PDF it will show the form data array. Can you include a snippet of field #77 here for review?Thanks for the snappy reply,
I tested adding &data=1 however that doesn’t seem to be changing anything. Im still just seeing the standard pdf view.Maybe I’m doing something wrong?
Let me know if you want any screenshots or anything.
Thanks.
If you don’t see anything different when adding
&data=1to the URL it means you based your custom PDF template off one of the default templates.To get this working you should instead have used one of the example template files. You’ll want to include any of the extra code from the example templates in your custom template.
After using your above advice I have fixed my issue, thanks for being patient and helping out.
Glad to be of assistance. If you have a minute I’d love it if you left a plugin review.
The topic ‘Post Image on template’ is closed to new replies.