Adding a link to a downloable high-resolution file (jpg)

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

Re: [gagester] Adding a link to a downloable high-resolution file (jpg)

By Chris - August 31, 2009 - edited: August 31, 2009

Hi gagester,

If I understand you correctly, each "client story" record has one image, and you want it displayed in three different sizes: one small, for the list page; one medium-sized, for the detail page; and one large, to be linked to from the detail page?

How about having your client upload the large image, and having CMSb generate both the medium and small images as thumbnails?

To do this, modify your upload field and check out the options under Input Validation. I've attached a screenshot of how I think you'll want them set up.

Your list page won't change, since you're not changing how the first thumbnail works. You'll want to add these code snippets to your detail page to show the medium-sized image and a link to the big one:

<!-- the medium-sized thumbnail -->
<?php foreach ($newsRecord['upload'] as $upload): ?>
<img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt='' /><br/>
<?php endforeach ?>

<!-- a link to the full-sized image -->
<?php foreach ($newsRecord['upload'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>">Download a high-resolution version of this photo</a><br />
<?php endforeach ?>


You'll need to change the name of the record variable (mine is $newsRecord in the above example) and the name of your field (if it isn't already named 'upload', like mine.) You'll also need to re-upload large versions of your existing images, or visitors will be disappointed when they click on that link! :)

I hope this helps! Please let us know if you have any questions or comments.
All the best,
Chris
Attachments:

upload_field_settings.png 37K