Image Don't Show on Web page
5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 14, 2012 (RSS)
By wow123 - May 12, 2012
www.mydomain.com/inventory.php
I have changed the Upload Directory to: ../uploads/
and the Upload Folder URL to: /cmsAdmin/uploads/
The images show up in the Section Editor when I create the listing, but it will not show up on the web site: www.mydomain.com/inventory.php
It gives me this ERROR:
Record Number: 1
_link : inventory-detail.php?1
image:
Upload Url: /cmsAdmin/uploads/13.jpg
All of the input fields show up fine.
Let me know what I need to do to fix this, thanks guys!
Re: [wow123] Image Don't Show on Web page
By gkornbluth - May 13, 2012
Do you mean that the page showed images once, and now that you've changed the upload directory the page doesn't show the images?
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Image Don't Show on Web page
By wow123 - May 14, 2012
the place where the image is suppose to be on the web site says this:
Record Number: 1
_link : inventory-detail.php?1
image:
Upload Url: /cmsAdmin/uploads/13.jpg
No Image shows up.
Here is the URL: http://www.seventhwing.com/inventory.php
Re: [wow123] Image Don't Show on Web page
By gkornbluth - May 14, 2012
OK, so far I’ve found a few things...
Your detail pages actually has an underscore not a dash. It’s probably mistyped in the section editor detail page URL field.
The code on your detail page is missing a < before ?php header('Content-type: text/html; charset=utf-8'); ?>
I can’t see the php code on your page, but for a link to your detail page the basic code could be something like:
<a href="<?php echo $record['_link'] ?>">the text, image or echoed field that you want to show on your page</a>
So to display an image on your list page that can be clicked on to access the detail page, the code inside your main foreach loop should be something like:
<?php foreach ($record['your_image'] as $upload): ?>
<a href="<?php echo $record[‘_link'] ?>"><img border="0" src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a>
<br />
Title: <?php echo $upload[‘info1'] ?>
<br />
Caption: <?php echo $upload[‘info2'] ?>
<br />
<?php endforeach; ?>
If you did not want to link the image, you could just use:
<?php foreach ($record['your_image'] as $upload): ?>
<img border="0" src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<br />
Title: <?php echo $upload[‘info1'] ?>
<br />
Caption: <?php echo $upload[‘info2'] ?>
<br />
<?php endforeach; ?>
border="0" gets rid of the border around your images that appears in IE.
If you were using this code on a detail page, you would leave off the foreach loops and replace each occurrance of the variable $record with $your_tableRecord.
Hope that helps,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [wow123] Image Don't Show on Web page
By Damon - May 14, 2012
The Code Generator will give you code examples for displaying image details in a variety of ways. Remove the HTML comments and publish all the image code to see what is available.
Next, remove any image publish code you don't want, then format as needed.
For example, use this code to publish thumbnail images that are linked to larger images:
<?php foreach ($record['image'] as $index => $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" title="<?php echo htmlencode($upload['info1']) ?>" /><br/>
</a>
<?php endforeach ?>
Please let me know if you have any questions or would like more details.
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/