Uploading Fields
4 posts by 3 authors in: Forums > CMS Builder
Last Post: August 3, 2009 (RSS)
By absolutejw - August 3, 2009
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
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: [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!
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/
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
By absolutejw - August 3, 2009
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
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:
Hope that helps!
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
interactivetools.com