Uploading Fields

4 posts by 3 authors in: Forums > CMS Builder
Last Post: August 3, 2009   (RSS)

Hi,

I am fairly new to CMS Builder. I am trying to have a section where I can upload a pdf or jpg and have this pdf or jpg as a thumbnail and have this thumbnail clickable to the path of the pdf or jpg uploaded.

This is the code I am trying to use but it only gives me a link:

<?php foreach ($vineyardmarinaRecord['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['/common/images/logo.jpg'] ?>" width="<?php echo $upload['178'] ?>" height="<?php echo $upload['128'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<a href="/common/images/logo.jpg" class="non-html"><img src="<?php echo $upload['urlPath'] ?>" alt="" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" border="0" /></a><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>

I would really appreciate some help to see how I can make this work.

Thanks

JW

Re: [ross] Uploading Fields

Hi Ross,

Thank you for the support. Yes your suggestion would work perfectly. Can you please show me how to modify the code to work with that.

Thank you once again.

Regards,

Johan

Re: [absolutejw] Uploading Fields

By Dave - August 3, 2009

Hi JW,

Here's what to add so PDFs show a predefined image. The new code is in red:

<?php foreach ($vineyardmarinaRecord['image'] as $upload): ?>

<?php if ($upload['extension'] == 'pdf'): ?>
<a href="<?php echo $upload['urlPath'] ?>"><img src="path/to/your/pdf/image/here.jpg"></a>


<?php elsif ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<a href="<?php echo $upload['urlPath'] ?>" class="non-html"><img src="<?php echo $upload['urlPath'] ?>" alt="" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" border="0" /></a><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>

<?php endforeach ?>


Hope that helps!
Dave Edis - Senior Developer
interactivetools.com