TOPIC:

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #194438

  • Topic Author
  • bettieee
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 2
Hi, I am trying to get the images from a multi-upload field to render in the email that gets sent to the admin.
I found some useful code on the forums, but only the first image is rendered. How would I get all the images from the array to show?

This is my code, the field name is "testimage".
<tr>
<?php
$upload = '';

if (count($xmldata)){
   foreach ($xmldata as $data) {
      $value = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
      switch($data[_FF_DATA_NAME]){
        case 'testimage':
          $upload = $value;
          break;
      }
    }
}
?>
<td colspan="2">
<img src="<?php echo $upload; ?>" width="150" />
</td>
</tr>

Please Log in or Create an account to join the conversation.

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #194455

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hi, please try this instead:
<tr>
<?php
$upload = '';

if (count($xmldata)){
   foreach ($xmldata as $data) {
      $value = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
      switch($data[_FF_DATA_NAME]){
        case 'testimage':
          $upload = $value;
          break;
      }
    }
}
$explodedpaths= ('|',$value);
foreach ($explodedpaths as $ep)
{echo "<td colspan='2'><img src=$ep width='150' /></td>";}
?>
</tr>

Let us know how it works out for you.

Regards,

Lovre
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #194488

  • Topic Author
  • bettieee
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 2
Unfortunately this didn't work. There was a blank page after I hit submit and no email was sent to the admin. The images did upload though.

I changed
$explodedpaths= ('|',$value);
to
$explodedpaths= explode('|',$value);
and the admin email was sent, but still only the first image shows.

Please Log in or Create an account to join the conversation.

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #194489

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hi,

yeah, sorry about the explode missing... I'll test locally this time so we're sure it works. I'll get back to you in a short while.

Regards,

Lovre
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #194582

  • Topic Author
  • bettieee
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 2
I finally got it to work using the following. Hopefully it is useful to someone else, all you have to do is replace "testimage" with the name of your multi-upload field.
<tr><td colspan="2">
<?php
if (count($xmldata)){
   foreach ($xmldata as $data) {
   	if ($data[_FF_DATA_NAME] = 'testimage'){
		$image = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
		echo '<img src="' . $image . '" width="150" height="100" border="0"/> ' ;  		
      		
      	}    		
     }
}
?>
</td></tr>
The following user(s) said Thank You: uglyeoin, oivanr

Please Log in or Create an account to join the conversation.

Last edit: Post by bettieee.

Render Images from Multi-Upload Field in PDF 3 years 4 months ago #195204

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hey,

This is great news. Thank you for sharing it with the community and grats on making it work on you own.

Let us know if you need any further assistance.

Regards,

Lovre
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!