Uploading Fields

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

Re: [absolutejw] Uploading Fields

By ross - August 3, 2009

Hi there.

Thanks for posting!

What you are running into here is that thumbnails are only created for images. When you upload a file like a PDF, it doesn't have a thumbnail. What I think would work best here is if you just had a generic PDF logo or icon that displays for each PDF you upload. Then, just use that image as the link instead of plain text. Does that make sense? Basically, every PDF you uploaded would end up with the same image.

Let me know what you think and I can show you how to modify to code to work with that.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

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