Displaying image from data type's property (Data Module)

View: New views
7 Messages — Rating Filter:   Alert me  

Displaying image from data type's property (Data Module)

by Rita_ () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

How do I display an image that is stored under the data module for my defined data type?

For example, I have a data type called "product" which has a property called "logo" (which is of data type binary). The content node created under the "product" data type was "test".

I tried the following in my jsp:

Content providerNode = null;

providerNode  = MgnlContext.getHierarchyManager("data").getContent("product/test");

String imageURL = providerNode.getNodeData("logo").getHandle() + "/" +
providerNode.getNodeData("logo").getAttribute("fileName") + "." +
providerNode.getNodeData("logo").getAttribute("extension");

However this imageURL doesn't retrieve the image in my jsp when I set it as the src in the image tag?


I would appreciate it if anyone could help me on this. Thanks.

Cheers,
Rita.



Re: Displaying image from data type's property (Data Module)

by Ing. Daniel Garcia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi.
try this...
 
      
      java.io.InputStream is = getFileStream from the value you're reading
      BufferedImage input  = javax.imageio.ImageIO.read(is);
 
trying to get the inputstream and to handle it with java code...  the rest should be easy.
that should work
 
Daniel

2009/10/22 Rita_ <mrita293@...>


Hi,

How do I display an image that is stored under the data module for my
defined data type?

For example, I have a data type called "product" which has a property called
"logo" (which is of data type binary). The content node created under the
"product" data type was "test".

I tried the following in my jsp:

Content providerNode = null;

providerNode  =
MgnlContext.getHierarchyManager("data").getContent("product/test");

String imageURL = providerNode.getNodeData("logo").getHandle() + "/" +
providerNode.getNodeData("logo").getAttribute("fileName") + "." +
providerNode.getNodeData("logo").getAttribute("extension");

However this imageURL doesn't retrieve the image in my jsp when I set it as
the src in the image tag?


I would appreciate it if anyone could help me on this. Thanks.

Cheers,
Rita.



--
View this message in context: http://www.nabble.com/Displaying-image-from-data-type%27s-property-%28Data-Module%29-tp25870338p25870338.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------



Re: Displaying image from data type's property (Data Module)

by Jan Haderka-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


String imageURL = MgnlContext.getContextPath() +"/data" +
providerNode.getNodeData("logo").getHandle();

should do the trick. Or even better:

String imageURL =
MagnoliaTemplatingUtilities.getInstance().createLink(providerNode.getNodeData("logo"));

HTH,
Jan

On Thu, 2009-10-22 at 19:49 -0700, Rita_ wrote:

>
> Hi,
>
> How do I display an image that is stored under the data module for my
> defined data type?
>
> For example, I have a data type called "product" which has a property called
> "logo" (which is of data type binary). The content node created under the
> "product" data type was "test".
>
> I tried the following in my jsp:
>
> Content providerNode = null;
>
> providerNode  =
> MgnlContext.getHierarchyManager("data").getContent("product/test");
>
> String imageURL = providerNode.getNodeData("logo").getHandle() + "/" +
> providerNode.getNodeData("logo").getAttribute("fileName") + "." +
> providerNode.getNodeData("logo").getAttribute("extension");
>
> However this imageURL doesn't retrieve the image in my jsp when I set it as
> the src in the image tag?
>
>
> I would appreciate it if anyone could help me on this. Thanks.
>
> Cheers,
> Rita.
>
>
>


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------


Vacation reply

by jlrafter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,
how are you doing recently?
I would like to introduce you a very good company and its website is
www.mydosell.com It can offer you all kinds of electronic products that you may be in need,such as laptops ,gps ,TV LCD,cell  phones,ps3,MP3/4,motorcycles and etc........
You can take some time to have a check ,there must be something interesting you 'd like to  purchase .
The contact
Email:  mydosell@...
MSN:   mydosell@...
 
Hope you can enjoy yourself in shopping from that company !
 
Regards



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------

Vacation reply

by jlrafter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,
how are you doing recently?
I would like to introduce you a very good company and its website is
www.mydosell.com It can offer you all kinds of electronic products that you may be in need,such as laptops ,gps ,TV LCD,cell  phones,ps3,MP3/4,motorcycles and etc........
You can take some time to have a check ,there must be something interesting you 'd like to  purchase .
The contact
Email:  mydosell@...
MSN:   mydosell@...
 
Hope you can enjoy yourself in shopping from that company !
 
Regards



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------

Re: Displaying image from data type's property (Data Module)

by Rita_ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks to Daniel and Jan for your replies.

Hi Jan,

Both your solutions worked. It was exactly what I was looking for!

Thanks alot.

Cheers,
Rita



Vacation reply

by jlrafter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,
how are you doing recently?
I would like to introduce you a very good company and its website is
www.mydosell.com It can offer you all kinds of electronic products that you may be in need,such as laptops ,gps ,TV LCD,cell  phones,ps3,MP3/4,motorcycles and etc........
You can take some time to have a check ,there must be something interesting you 'd like to  purchase .
The contact
Email:  mydosell@...
MSN:   mydosell@...
 
Hope you can enjoy yourself in shopping from that company !
 
Regards



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------