Displaying Teaser Image in dmFact

2 views
Skip to first unread message

Steve Clason

unread,
Jan 11, 2007, 1:36:14 PM1/11/07
to farcr...@googlegroups.com
Hi,

I think this is a bonehead question, but...

In upgrading a client to v. 3.0.1 from 2.? we lost the display of the
teaser image in the dmFact content type.

I see that the structure for the content object now includes the UUID of
the teaser image instead of the path to the image, but I can't for the
life of me figure out how to get the image path from the UUID, and I
can't find an example anywhere.

So, I need something like <img src="#getPathToImage(stObj.imageId)#">

Can anyone lend a guy a hand?
--
Steve Clason
Boulder, Colorado, USA
(303) 818-8590

Stephen Moretti

unread,
Jan 11, 2007, 2:10:08 PM1/11/07
to farcr...@googlegroups.com
I think what you're after is:

oImage = createobject("component","farcry.farcry_core.package.types.dmImage");
imagePath = getURLImagePath(stObj.ImageID,"thumb|original|optimised");

Regards

Stephen

Steve Clason

unread,
Jan 13, 2007, 4:28:05 PM1/13/07
to farcr...@googlegroups.com
Stephen Moretti wrote:
> I think what you're after is:
>
> oImage =
> createobject("component","farcry.farcry_core.package.types.dmImage");
> imagePath = getURLImagePath(stObj.ImageID,"thumb|original|optimised");
>

> In upgrading a client to v. 3.0.1 from 2.? we lost the display of the


> teaser image in the dmFact content type.
>
> I see that the structure for the content object now includes the UUID of
> the teaser image instead of the path to the image, but I can't for the
> life of me figure out how to get the image path from the UUID, and I
> can't find an example anywhere.
>
> So, I need something like <img src="#getPathToImage(stObj.imageId)#">

Thanks for the suggestion, Stephen. It turns out that wasn't what I
needed (or was but I didn't realize it.)

I found my solution at Trond Ulselth's blog:
http://trond.ulseth.no/index.cfm/FarCry

I just needed to add a piece of code in the display method for dmFact.
I'm including the entire file in case someone else can use it:

<cfsetting enablecfoutputonly="yes">

<cfimport taglib="/farcry/fourq/tags" prefix="q4">
<cfoutput>
<table id="extLinks">
<tr>
<td class="extLogo">
<cfif len(trim(stObj.imageId)) gt 0>
<q4:contentobjectget objectID="#stObj.imageId#"
r_stobject="getObject">
<cfoutput><img src="/images/#getObject.imagefile#" align="right"
alt="#getObject.alt#" /></cfoutput>
</cfif>
</td>
<td class="extTeaser">
<h4><a href="#stObj.link#" target="_new">#stObj.Title#</a></h4>
<p>#stObj.body#</p>
</td>
</tr>
</table>
</cfoutput>
<cfsetting enablecfoutputonly="no">

Stephen Moretti

unread,
Jan 14, 2007, 5:22:11 AM1/14/07
to farcr...@googlegroups.com


On 13/01/07, Steve Clason <ste...@topdogstrategy.com> wrote:

Thanks for the suggestion, Stephen. It turns out that wasn't what I
needed (or was but I didn't realize it.)

I found my solution at Trond Ulselth's blog:
http://trond.ulseth.no/index.cfm/FarCry

I just needed to add a piece of code in the display method for dmFact.
I'm including the entire file in case someone else can use it:

Ah ok - what Trond has done is bypass the dmImage component and used the fourQ method to get the data for an ObjectID no matter what the data type is. This the same as doing :

stImage = createobject("component","farcry.farcry_core.package.types.dmImage").getData(stObj.ImageID);

This works well - however - if you don't have your images stored in /images/ or if you upgrade to Gonzales (FC4 beta) you'll need to change this code.  Using the getURLImagePath method in the dmImage component will ensure that you get the correct path when you move your images to another folder, change the farcry config or upgrade to FC4.

Regards

Stephen

Steve Clason

unread,
Jan 14, 2007, 4:22:38 PM1/14/07
to farcr...@googlegroups.com
Stephen Moretti wrote:
>
>
> On 13/01/07, *Steve Clason* <ste...@topdogstrategy.com

That's good to know, thanks for the information.

Reply all
Reply to author
Forward
0 new messages