[opencms-dev] Photo album overview to crop images

Yves Glodt yg at mind.lu
Mon Aug 2 10:35:42 CEST 2010


Hi Inge,

using CmsPhotoAlbumConfiguration(CmsJspActionElement jsp) the scaling works.

A big step forward already. But it affects the detail-view, and not the
overview.

Where can I find the template or jsp-page which is used to render the
overview? I looked in /system/modules/org.opencms.frontend.photoalbum/ but
could not find anything




p.s.

My code in my gallery-detail-template:

CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
CmsPhotoAlbumBean cmsPhoto = new CmsPhotoAlbumBean(pageContext, request,
response);

CmsPhotoAlbumConfiguration configuration = new
CmsPhotoAlbumConfiguration(cms);
configuration.getDetailImageScaler().setQuality(90);
configuration.getDetailImageScaler().setType(2);
configuration.getDetailImageScaler().setCropArea(0, 0, 600, 600);
cmsPhoto.setConfiguration(configuration);




On 2 August 2010 10:14, Paul-Inge Flakstad <flakstad at npolar.no> wrote:

>  Hi again Yves,
>
> The empty CmsPhotoAlbumConfiguration constructor does no initialization. I
> assume that's why it won't work.
>
> Instead you should probably use one of the other constructors:
> CmsPhotoAlbumConfiguration(CmsJspActionElement jsp)
> CmsPhotoAlbumConfiguration(CmsJspActionElement jsp, java.lang.String
> configUri)
>
> Best regards,
> Paul
>
>  ------------------------------
> *From:* opencms-dev-bounces at opencms.org [mailto:
> opencms-dev-bounces at opencms.org] *On Behalf Of *Yves Glodt
> *Sent:* 29. juli 2010 13:47
>
> *To:* The OpenCms mailing list
> *Subject:* Re: [opencms-dev] Photo album overview to crop images
>
> Hi,
>
> I did what you suggested, without a result...
> when I set back the CmsPhotoAlbumConfiguration to the CmsPhotoAlbumBean
> object, the album detailoverview is not displayed at all anymore....
>
> Any more hints for my square details pics ?
>
> Best regards,
> Yves
>
> CmsPhotoAlbumBean cmsPhoto = new CmsPhotoAlbumBean(pageContext, request,
> response);
>
> // set the CSS style class names
> CmsPhotoAlbumStyle style = new CmsPhotoAlbumStyle();
> style.setClassThumbTable("pgThumbTable");
> style.setClassThumbImageTitle("pgThumbImageTitle");
> style.setClassThumbText("pgThumbText");
> style.setClassNavigation("pgNavigation");
> style.setClassDetailImageDescription("pgDetailImageDescription");
> style.setClassDetailImageTitle("pgDetailImageTitle");
>
> cmsPhoto.setStyle(style);
>
> CmsPhotoAlbumConfiguration configuration = new
> CmsPhotoAlbumConfiguration();
> configuration.getDetailImageScaler().setQuality(90);
> configuration.getDetailImageScaler().setType(2);
> configuration.getDetailImageScaler().setCropArea(0, 0, 80, 80);
>
> cmsPhoto.setConfiguration(configuration); <- when I add this line, the
> album is not displayed at all anymore
>
>
>
> On 9 July 2010 15:38, Paul-Inge Flakstad <flakstad at npolar.no> wrote:
>
>>  Hi Yves,
>>
>> That method is protected, so you cannot access it directly.
>>
>> Try something like this instead (haven't tested it myself):
>>
>> CmsPhotoAlbumConfiguration configuration = new
>> CmsPhotoAlbumConfiguration();
>> configuration.getDetailImageScaler().setQuality(90);
>>  configuration.getDetailImageScaler().setType(2);
>>  configuration.getDetailImageScaler().setCropArea(0, 0, 80, 80);
>>
>> Hope this helps. :)
>>
>> Best regards,
>> Paul
>>
>>  ------------------------------
>> *From:* opencms-dev-bounces at opencms.org [mailto:
>> opencms-dev-bounces at opencms.org] *On Behalf Of *Yves Glodt
>> *Sent:* 9. juli 2010 15:21
>> *To:* The OpenCms mailing list
>> *Subject:* Re: [opencms-dev] Photo album overview to crop images
>>
>>   I tried the following code down here in the template of my photoalbum.
>> Unfortulately it fails with:
>>
>> "The method setDetailImageScaler(CmsImageScaler) from the type
>> CmsPhotoAlbumConfiguration is not visible"
>>
>> Anybody got a hint for me... :-) ?
>>
>> Best regards,
>> Yves
>>
>>
>> *CmsImageScaler scaler = new CmsImageScaler();
>> scaler.setQuality(90);
>> scaler.setType(2);
>> scaler.setCropArea(0,0,80,80);
>>
>>
>> CmsPhotoAlbumConfiguration configuration = new
>> CmsPhotoAlbumConfiguration();
>> configuration.setDetailImageScaler(scaler); // it fails here
>>
>> cms.setConfiguration(configuration);
>> //cms.getConfiguration().getDetailImageScaler().setType(2);
>> //cms.getConfiguration().getDetailImageScaler().setCropArea(0,0,80,80);
>>
>> *...
>>
>> cms.displayAlbum();
>>
>>
>>
>>
>> On 6 July 2010 09:57, Yves Glodt <yg at mind.lu> wrote:
>>
>>> Bumping...
>>>
>>> In fact, to clarify, I need to show the images in the gallery overview in
>>> a square shape (100x100px), not rectangle.
>>>
>>> Doing some research I found that I can probably edit the template used
>>> for the photo album and create a custom instance of CmsImageScaler.
>>>
>>> Is that possible? Are there any examples around?
>>>
>>> Best regards,
>>> Yves
>>>
>>>
>>> On 22 June 2010 10:28, Yves Glodt <yg at mind.lu> wrote:
>>>
>>>> Hello,
>>>>
>>>> is it possible to have the photoalbum crop the images in the overview?
>>>> (I have a situation where the overview should have square images only.)
>>>>
>>>> Best regards,
>>>> Yves
>>>>
>>>
>>>
>>
>>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20100802/c0d56241/attachment.htm>


More information about the opencms-dev mailing list