Handling image uploads
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 14, 2008 (RSS)
Can you explain how I reference the full size image versus the thumbnail?
I would like the thumbnail image to be clickable to the full size image. DO I have to make this link manually or is there an automatic way to do it?
I see the full size image in the cmsAdmin/uploads/ directory but I do not see it appear on my php pages.
I am making a Staff page and the list page shows the thumbnail perfectly on the staff list, but there is no sign of the full size image on the detail page.
Thank you in advance, Julia
I would like the thumbnail image to be clickable to the full size image. DO I have to make this link manually or is there an automatic way to do it?
I see the full size image in the cmsAdmin/uploads/ directory but I do not see it appear on my php pages.
I am making a Staff page and the list page shows the thumbnail perfectly on the staff list, but there is no sign of the full size image on the detail page.
Thank you in advance, Julia
Re: [macwebster] Handling image uploads
By Dave - November 14, 2008
Hi Julia,
The Code Generator should generate image tags for both. Usually it looks something like this:
I've highlighted the important parts in red.
What this code does is display the thumbnail if it's available, or if not then the full size image, or if that's not available then a link to the file (since it's probably a PDF or something). So we take the thumbnail image tag and link it to the full size image url like this:
Hope that helps!
The Code Generator should generate image tags for both. Usually it looks something like this:
I've highlighted the important parts in red.
<!-- STEP 2a: Display Uploads for field 'uploads' (Paste this anywhere inside STEP2 to display uploads) -->
<?php foreach ($newsRecord['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
What this code does is display the thumbnail if it's available, or if not then the full size image, or if that's not available then a link to the file (since it's probably a PDF or something). So we take the thumbnail image tag and link it to the full size image url like this:
<a href="<?php echo $upload['urlPath'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>"
alt="" /></a>
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com