Print Image Title
10 posts by 4 authors in: Forums > CMS Builder
Last Post: March 3, 2009 (RSS)
Re: [Dan Maitland] Print Image Title
By Kenny - February 22, 2009 - edited: February 22, 2009
Use echo statements to do this like any other data. For example:
<?php echo $upload['info1'] ?> will display what ever you have that textfield set to. In this case, you probably have info1 set to "Title"
<?php echo $upload['info2'] ?> will display your second textfield
Make sense?
Kenny
Re: [sagentic] Print Image Title
By gkornbluth - February 22, 2009 - edited: February 22, 2009
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: [sagentic] Print Image Title
Thank you for responding. If I want to upload an image and have its title and/or caption underneath/beside it I would insert the code:
<?php echo $upload['info1'] ?>
Where would I put this code exactly? I understand the principal and even tried it but I'm not sure i placed it in the right place. Can you clear that up for me. Thanks.
Re: [Dan Maitland] Print Image Title
By Kenny - February 23, 2009
This is some code that would place the title under the image. It's very simple without any styling.
<!-- STEP 2a: Display Uploads for field 'story_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 ($galleryRecord['photo'] 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 echo $upload['info1'] ?><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
Pretty much anywhere you have <?php echo $upload['info1'] ?> is where it will show up as long as it is between the foreach and endforeach statements.
Also, make sure you use your specific foreach statement and not mine as your table names and fields may be different.
If this gives you trouble, send your code you have now over, and we can clean it up for you.
Kenny
Re: [sagentic] Print Image Title
Re: [Dan Maitland] Print Image Title
By jtedescojam - March 3, 2009
<?php foreach ($mezzanine_shelvingRecord['photo'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php elseif ($upload['isImage']): ?>
<br/>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br /><?php echo $upload['info1'] ?>
<br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
Creative Director
JAM Graphics
Re: [jtedescojam] Print Image Title
By Kenny - March 3, 2009
Under Advanced Options for the "Photos" do you have anything listed next to info1, info2, etc....?
Kenny
Re: [sagentic] Print Image Title
By jtedescojam - March 3, 2009
This is strange, because it worked without a problem anywhere I placed that code after the 'foreach' statement and BEFORE the 'elseif' statement, and also worked when I placed it after the 'endif' stament.
So it's working now... it's going to be very difficult to get the caption to fall under each image perfectly (because I have float and margin styles attached to these images.)
Wondering, can you tell me how to write this code so the thumbnail is clickable to a bigger image?
Thank you for the quick response.
Creative Director
JAM Graphics
Re: [jtedescojam] Print Image Title
By Kenny - March 3, 2009
Try this tutorial I wrote a while back for making your images larger.
http://www.interactivetools.com/forum/gforum.cgi?post=64222#64222
There are many ways to do it, bu this one has some cool effects to it.
Kenny