Posts Tagged ‘blob’


In the previous post, we have discussed how to render text stored in a blob. In this post, we will know how to render an image which is stored in the blob.

The following code is used to render the image blob. Here, I’m using render:satelliteblob tag to render the image.

<!--load the child asset -->-

<assetset:setasset name="myasset" id='<%=ics.GetVar("childId") %>' type='<%= ics.GetVar("childType") %>' />

<assetset:getmultiplevalues name="myasset" byasset="false" prefix="atlst">

   <assetset:sortlistentry attributetypename="Content_A" attributename="my_image"/>

</assetset:getmultiplevalues>

<!--Render the Image -->

<ics:listloop listname="Imagelist">

    <ics:listget listname="Imagelist" fieldname="value" output="o_value"/>

    <render:satelliteblob service="img src" blobtable="MungoBlobs" blobkey="id" 

                    blobwhere='<%=ics.GetVar("o_value")%>' blobcol="urldata"/>
</ics:listloop>


//In this way, we can render an image in Fatwire using the Satellite blob tag.

Advertisements

If you have a requirement of using the Flex Family, and render the text stored in Blobs, this example would definitely help you.

For example, if you want to allow the user to enter a Huge text (that would not fit according to the normal RDBMS standards), then this concept of blobs can be used. Following are the steps that need to be done in order to successfully create and render the blob.

  • Create a flex attribute “text” with BLOB  as the Value Type, and if you want to specify any attribute editors like FCKEditor, EWebEditPro, etc, then specify them as well.
  • Enable that attribute in the Flex Definition, so that it becomes a part of the flex asset, and will be visible in the asset creation form.
  • Now, the content you enter in the form will be stored in the file system, instead of being stored in the database system.

After creation of the asset, the next thing to do is coding the template that renders the blob which we have created earlier.

  • In the import section of the jsp, import the blobservice tag library:
        <%@ taglib prefix="blobservice" uri="futuretense_cs/blobservice.tld"%>
  • Load the asset:
        <assetset:setasset name="myasset" id='<%=ics.GetVar("cid")%>' type='<%= ics.GetVar("c")%>'/>
  • Load the attribute from the asset
        <assetset:getattributevalues name="myasset" typename="PageContent_A" attribute="text"
                  listvarname="Textfile"/>
  • Render the blob:
      <ics:listloop listname="Textfile" maxrows='<%=ics.GetVar("rows")%>'>
                 <ics:listget listname="Textfile" fieldname="blobvalue" output="textvalue"/>
                 <blobservice:readdata id='<%=ics.GetVar("textvalue")%>' listvarname="Textdata"/>
                 <render:stream list="Textdata" filecolumn="urldata"/>
      </ics:listloop>

In the preview of your website/page, the text should be rendered.