When trying to add an image to a PDF render, it doesn't appear to work. In that it wont replace the feild (%image) with the actual image.

Comments

mdinamar’s picture

It would be great to have support for images. Maybe with hooks could be?. Cheers

BD3’s picture

Has anyone had success with this? I would like to see this as well.

salientknight’s picture

Not only does this not include attached images, but there is no way to get the image from the submitted data field. I tried adding the field name, but still cannot even get the data.

Is there an easy way to do this or a reason why these fields data wont show up?

OK so after some digging I see that the only thing stored in the data field for a file, is a link to the fid that stores it. I'll have a solution to this shortly.

Thanks!

salientknight’s picture

OK I got images working. You way want to add another filter based on mime type to exclude files that are no images but here is my solution...

first have to add a case path for file to get the token to show up in the list of tokens
on line 248: case 'file':

Then get the file path from files table
On line 420 I added

//this gets the file path for the image
case 'file':
         if ( !empty($submission->data[$component['cid']]['value'][0]) ) {
              $fid=$submission->data[$component['cid']]['value'][0];
               if($fid_result= db_query("select filepath from {files} where fid=".$fid)){
               $fid_record = db_fetch_object($fid_result);
               $fid=$fid_record->filepath;
			 }else $fid='error finding image location';
            
            $tokens['%' . $component['form_key']] =$fid;
          }
          else {
            $tokens['%' . $component['form_key']] = '';
          }
         
         break;

The last step is to wrap the returned value in an image tag. To get this to work for me, I had to use the fully qualified path

<img src="http://www.mywebsite.org/%please_attach_a_photo" />

When I next loaded my pdfs the images were attached.

I hope this helps....

tusshar.kant’s picture

Version: 6.x-2.0-rc1 » 7.x-3.0

Sir salientknight , will please tell me which file to edit???????

jinx_ven’s picture

Hi salientknight. Can u say which file want to edit?????? in drupal 7

rabindrakumar’s picture

Hi Folks,

Do anyone have any solution for this ,I have the same issue .Please suggest .

Thanks

rabindrakumar’s picture

Priority: Normal » Major
Issue summary: View changes

It gives output as image url only and not replaced with image in PDF . When I use Only local images are allowed. tag with src as url ,the image is not displayed.