
kcmedia
User
Jul 14, 2009, 5:23 PM
Post #1 of 14
(2992 views)
Shortcut
|
|
Image linked to PDF document
|
Can't Post
|
|
Hi I have 2 uploads in the section one for uploading image and one for uploading pdf documents i want to be able to make that image linked to the pdf document so when you click on the image it will open the pdf i cant for the life of me get it to work. here is the code viewer. <?php header('Content-type: text/html; charset=utf-8'); ?> <!-- INSTRUCTIONS --> <div class="instructions"> <b>Sample List Viewer - Instructions:</b> <ol> <?php /*><li style="color: red; font-weight: bold">Rename this file to have a .php extension!</li><x */ ?> <li><b>Remove any fields you don't want displayed.</b> (Most list pages only have title and link fields.)</li> <li>Rearrange remaining fields to suit your needs.</li> <li>Copy and paste code into previously designed page (or add design to this page).</li> </ol> </div> <!-- /INSTRUCTIONS --> <!-- STEP2: Display Records (Paste this where you want your records to be listed) --> <h1>Downloads - List Page Viewer</h1> <?php foreach ($downloadsRecords as $record): ?> Record Number: <?php echo $record['num'] ?><br/> Title: <?php echo $record['title'] ?><br/> _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/> <!-- STEP 2a: Display Uploads for field 'file' (Paste this anywhere inside STEP2 to display uploads) --> <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 --> <?php foreach ($record['file'] 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 --> <!-- STEP 2a: Display Uploads for field 'link_image' (Paste this anywhere inside STEP2 to display uploads) --> <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 --> <?php foreach ($record['link_image'] 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 --> <hr/> <?php endforeach; ?> <?php if (!$downloadsRecords): ?> No records were found!<br/><br/> <?php endif ?> <!-- /STEP2: Display Records --> Thanks Craig KC Media Solutions www.kcmedia.biz
|