6

I am trying to edit an image field of a component through XPM but not able to get the desired options. Below is the screen shot

enter image description here

I have taken all the steps described in this question : "How to change image using Experience Manager?"

The markup is getting created properly:

 <div><span><!-- Start Component Presentation: {"ComponentID" : "tcm:55-211",
 "ComponentModified" : "2014-07-24T07:41:48", "ComponentTemplateID" : "tcm:55-727-32", 
"ComponentTemplateModified" : "2014-07-24T07:49:17", "IsRepositoryPublished" : false } -
->

 <!-- Start Component Field: {"XPath" : "tcm:Content/custom:Content/custom:largeimage[1]"} 
-->
<img src="/Images/products-wipers.png"  alt="hello"/>
</span></div>

   <!-- Page Settings: {"PageID":"tcm:55-720-64","PageModified":"2014-07-24T07:49:45",
"PageTemplateID":"tcm:55-178-128","PageTemplateModified":"2014-07-23T09:06:42"} -->

<script type="text/javascript" language="javascript" defer="defer" 
src="http://tridiondev/WebUI/Editors/SiteEdit/Views/Bootstrap/Bootstrap.aspx?mode=js" 
id="tridion.siteedit"></script></body>

Is there any specific JAR file required for Image editing in XPM which could be missing?

Any help would be appreciated.

1
  • Not 100% on this but you may need another div/span around the image and its XPM field markup.
    – Ant P
    Jul 24, 2014 at 6:51

1 Answer 1

2

So looking at your screenshot I'm assuming the problem you are referring to is that the border in XPM does not match the size of your image right? (in that case, it would be beneficial that you update your question and make the actual problem a bit more clear)

The border as shown in XPM is generated based on the XPM markup and the HTML elements around that. In your case you want a border around an img element (which is an inline block level element), and for that you have the <!-- Start Component Field: {...} --> markup placed above it and wrapped in a span element.

Now the span element is in HTML a inline element, and this is what is used by XPM to draw the border, so it will pick up the width of your image, but unfortunately, it won't pick up the height of the image. If you would change that span into a div (which is a block level element), you will notice that the border will be nicely around your image.

Now the next (possible) issue is that you have both the <!-- Start Component Presentation: {...} --> and the <!-- Start Component Field: {...} --> markup wrapped in the same HTML element (in your case the span). This means that both the Component Presentation border and the Component Field border (the border around the image), will have the exact same size. So when you hover over the image, you will never see the Component Presentation border, or at the least it will be difficult to reach. Ideally you should adjust the HTML to work better with XPM, and you could consider something like:

<div><!-- Start Component Presentation: {"ComponentID" : "tcm:55-211", "ComponentModified" : "2014-07-24T07:41:48", "ComponentTemplateID" : "tcm:55-727-32", "ComponentTemplateModified" : "2014-07-24T07:49:17", "IsRepositoryPublished" : false } -->
    <div><!-- Start Component Field: {"XPath" : "tcm:Content/custom:Content/custom:largeimage[1]"} -->
        <img src="/Images/products-wipers.png"  alt="hello"/>
    </div>
</div>

It seems a minor change, but it will have a huge effect on the usability. Other options could be to give the span (or whatever other HTML element you are using to wrap the XPM markup in) a different display properly (like display:block; or display:inline-block;), see also http://www.w3schools.com/cssref/pr_class_display.asp

5
  • Thanks Brat, but i'm still not able to edit the image. I have applied the div tags as described by you. After doing so, I am able to get the proper border around the image and on clicking the image it opens the "Edit multimedia link" panel in XPM. But as soon as I click on apply after selecting a multimedia component, it throws this error: 'There was an error deserializing the object of type Tridion.ContentManager.Data.IdentifiableObjectData. There are multiple root elements. Line 18, position 267.' Jul 24, 2014 at 11:36
  • Also, i believe that these divs and spans are auto generated on page, I have just provided the inline editing markup on dwt.. something like this: ' <!-- Start Component Field: {"XPath" : "tcm:Content/custom:Content/custom:largeimage[1]"} --> <img src="@@Component.Fields.largeimage@@" tridion:type="Multimedia" alt="hello"/>"' Is there anything that is incorrect in this markup.. Please suggest.. Thanks Jul 24, 2014 at 11:42
  • @Saurabh if your problem is not selecting the image but changing it, and you get an error, then EDIT your question and add the error in there, how do you expect to get answer to the issue when you don't specify the information in your question? Nobody has a crystal ball here you know, oh and please put on your reading glasses since my name is not Brat. Jul 24, 2014 at 13:00
  • @Saurabh with regards to the div and span being auto generated, while you have put on your reading glasses, I think it is about time to start reading the documentation and see what options you can specify in the Inline Editing TBBs, you have full control over what HTML you want it to create for you there. Jul 24, 2014 at 13:02
  • Ok.. thanks "Bart".. and sorry for the name.. :) Jul 25, 2014 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.