Dashboard > Atlassian Plugins > ... > Macros > report-image
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  report-image

Added by david , last edited by Jonathan Appel [CustomWare] on Sep 02, 2008  (view change) show comment
Labels: 

{report-image}

Plugin: Reporting Plugin

Displays the specified key chain value for the current item as an image.

Description

It is assumed that the key value retrieved is an absolute (e.g. "http://server/folder/file.gif") or server-relative (e.g. "/folder/file.gif") URL.

Usage

{report-image:prefix:key|width=16px|height=16px}

Parameters

Name Required Default Description
[default]/key
The key chain to use as the image URL.
width
The width of the image, using standard CSS units (eg. "20px" or "80em").
height
The height of the image, using standard CSS units (eg. "20px" or "80em").
border
The border style of the image, using standard CSS values (eg. "2px dashed red").

Examples

Display the current page creator's personal picture.
{report-image:content:creator > user:picture}

Recipes

See Also

Hi,

In order to make a pretty blog-like website using reports from the various pages present on the Confluence spaces we have, I've written a macro for displaying the "first image" attached to each reported page...

However, I could not manage:

  1. to distinguish "image" attachments from other attachments type (it tries to generate images from .doc etc... attachments if they are the first attachment for the moment...)
  2. not to generate broken html code when there is no image (i.e. no attachment for the moment)
  3. generate thumbnails (using standard wiki markup, it seems the code is generated too late for the image include process, while writing directly the generated code in wiki markup works fine)

Could the thumbnail feature be added to this macro in future versions? Do you know a way to use the report-info macro inside standard wiki markup (with injected=true I cannot get the content:summary...)? Do you know how to filter out other attachment types (inside a report-body? or with a proper expand-on macro which is an "inclusive" join rather than exclusive?... There may not be enough examples of how to use this macro for complex cases...

The reporting plugin is at the heart of the homepages of our website, It's what makes the various contents very easy to access.

Thanks a lot for your help,
Vincent

My suggestion here would be to use report-block. To display the 'first image', try something like this:

{report-block:maxResults=1}
{local-reporter:content:attachments}
  {text-filter:content:content type|include=image/.*}
{local-reporter}
{report-body}{report-image:content:download path}{report-body}
{report-block}

Could the thumbnail feature be added to this macro in future versions?

With regards to providing the thumbnail URL, yes, it should be done. As with any feature you'd like to see, the best way is to create a feature request. Comments here are not reviewed when we're working on a new version - it has to be in JIRA, or it doesn't happen.

Do you know a way to use the report-info macro inside standard wiki markup (with injected=true I cannot get the content:summary...)?

You could try the Replace and Render plugin

Do you know how to filter out other attachment types (inside a report-body)?

Not sure what you mean.

or with a proper expand-on macro which is an "inclusive" join rather than exclusive?... There may not be enough examples of how to use this macro for complex cases...

You can use sub-reports to achieve this kind of thing. In recent versions of reporting additional '{report-block-1}' (through 5) macros have been added, so you can now put sub-reports in your report-body entries. If this isn't sufficient for your needs, please create a feature request with some examples of what you would like to achieve.

And yes, there are probably not enough examples...

Do you know how to filter out other attachment types (inside a report-body)?
Not sure what you mean.

The content supplier does not allow to easily select only certain types of attachments: for example, I'd like to get only the images, not the *.doc etc... attachments.

Something like content:attachments > type:image/.* could generate the list of attachments that are of the requested type.

I'll write the feature request for this too.

Thanks for your help,
Regards,
Vincent

You can use sub-reports for this kind of thing, but yes, there isn't any convenient way to filter and/or sort lists of results in a simple way at present.

Hi,
is there any other way to report on a specific image than this ?

{report-block}
{local-reporter:content:attachments|Source=BIBLI:Bilder und Logos}
{text-filter:content:file name|include=noimage.png}
{local-reporter}
{report-body}
{report-image:content:download path}
{report-body}
{report-block}

maybe something in only one line
e.g.

{report-image:content:attachments>content:download path|Source=BIBLI:Bilder und Logos|include=noimage.png}

Sure - you can specify a particular source value for any of the {report-info/image/link} macros. Just specify the attachment as the source as you would in a regular link. Something like this:

{report-image:content:download path|source=BIBLI:Bilder und Logos^noimage.png}

It can be relative to the current page (or reported item) also (ie. '^noimage.png').



Updated by Christian Nesemann
Aug 21, 2008 20:10

ah just saw my error

had the content:attachments before the content:download path

ok i have two further question to this

Is it possible to directly display an image via a server relative url (e.g. /images/icons/web_16.gif) ?

Is there a default parameter (e.g. default=BIBLI:Bilder und Logos^NOICON.gif) as none is documented above?

I believe the answer to both of these questions is no, currently. I think you could hack around the first issue with something like this:

{report-on:injected=true}!%request:scheme%://%request:server name%%request:context path%/images/icons/web_16.gif!{report-on}

Not exactly pretty...



Updated by Christian Nesemann
Aug 21, 2008 23:54

Hi,

thx for (always fast) reply.

But in this case i thought more of an option for the report-image macro.

By the way the above markup doesn't work.

Will create a feature request for it especially for the default-option!

Hi,

I'm trying to use the macro to collect images from various children pages to be displayed on a separate page. Ideally, the images in the children pages would not be attachments, but rather embedded in the page.

 I would also like to be able to link the reported images back to the child page, so that when I click on a specific images on the page where they are all reported it takes me to the page where that image lives.

 Your help would be much appreciated.

Thanks

Something like this should do the trick (using Reporting 3.0):

{report-block}
{expanding-reporter:content:attachments|as=attachment}
  {local-reporter:content:children}

  {text-sort:attachment:file name}

  {text-filter:attachment:content type|include=image/.*}
{expanding-reporter}

{report-body}{report-link:expanded:item}{report-image:expanded:attachment > attachment:download path}{report-image}{report-link}{report-body}

{report-block}

Thanks for the fast reply. I forgot to mention that we are using Confluence 2.5.6, so unfortunately it does not recognize Reporting 3.0. We should be migrating to 2.9 in a couple of months, so i'm not sure if it will work with that.

 Is there something that would work with 2.5.6?

Thanks!

Yeah, it's similar, but you use the expand-on macro instead (which is kind of reversed). Something like this:

{report-block}
{local-reporter:content:children}
  {expand-on:content:attachments}
    {text-sort:content:file name}
    {text-filter:content:content type|include=image/.*}
  {expand-on}
{local-reporter}

{report-body}{report-link:expanded:item}{report-image:expanded:attachment > content:download path}{report-image}{report-link}{report-body}

{report-block}

Note the exclusive use of 'content' as the prefix here also - the type-specific prefixes were added in 3.0.

View the rest of this thread  |  3 more comments by 2 persons
Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators