[MAGNOLIA-365] ifNotEmpty doesn't work for jpegs Created: 02/May/05  Updated: 23/Jan/13  Resolved: 17/May/06

Status: Closed
Project: Magnolia
Component/s: samples, taglibs
Affects Version/s: 2.01
Fix Version/s: 2.1.5

Type: Bug Priority: Minor
Reporter: Boris Kraft Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AIX


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

The following code snippet does work fine for gifs, but does not for jpegs.

— 8< —
<%@ taglib uri="cms-taglib" prefix="cms" %>
<%@ taglib uri="cms-util-taglib" prefix="cmsu" %>

<cms:ifNotEmpty nodeDataName="image">
<img src="<cmsu:fileSrc nodeDataName="image"/>">
</cms:ifNotEmpty>

— 8< —

I have the following workaround:

<%@ page import="info.magnolia.cms.core.ContentNode,
info.magnolia.cms.util.Resource,
info.magnolia.cms.gui.misc.FileProperties"%>
<%@ taglib uri="cms-taglib" prefix="cms" %>
<%@ taglib uri="cms-util-taglib" prefix="cmsu" %>

<%
ContentNode activePage = Resource.getLocalContentNode(request);
if (activePage.getNodeData("image").isExist())

{ %> <img src="<cms:out nodeDataName="image"/>" alt="<cms:out nodeDataName="imageAlt"/>"> <% }

%>

I don't know if it is still broken in the current code base.



 Comments   
Comment by Boris Kraft [ 02/May/05 ]

Forgot to say: the ifNotEmpty is the problem, not the cmsu:fileSrc. If I remove the ifNotEmpty tags, the jpeg gets displayed fine.

Comment by Michael Aemisegger [ 02/May/05 ]

I noticed that big downloads files take a long time to check whether there empty or not. This is because all the content is loaded from disk and then compared to an empty string.

I think a tag pair isExisting / isNotExisting would make sense to speed up the templates. The check for existence of a node is quite fast.

Comment by Philipp Bracher [ 17/May/06 ]

please reopen if still the case

Generated at Mon Feb 12 03:16:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.