1

I am not able to have url of the image component,though a part of tcm-id of component is showing as follows:

<img src="@Model"/> is rendering as <img src="23746"/>

@Model.ToString() is rendering as Image: 23746

But when I use @Model.Url, it returns null value.

Also, I have already published another component having that image component,and its success also.

What might be the issue?

EDIT 1:

"Image: 23746" is the tcm id of the image component which I am trying to map

UPDATE 1

After some tweaks, now the image url is coming, but an error of "image not found" is coming as follows:

Item '/en/media/myimage_tcm1010-23744.svg' not found for Localization '1010'. Sending HTTP 404 (Not Found) 
9
  • 1
    Seem to me you have not Modelled your Image Schema correctly. You need to use the DD4T IMultimedia and the [Multimedia] Attribute Commented Mar 6, 2018 at 9:22
  • Model i m using is an existing one which has already been implemented..and..all the images related to it are coming dynamically.. Commented Mar 6, 2018 at 9:57
  • 1
    If that is the case then you need to look at how it has been implemented to figure out how to get the image url or tell us how it has been implemented so we can help you. Just saying you are getting strings does not mean anything. Commented Mar 6, 2018 at 10:17
  • 1
    This seems to be a DXA-based implementation? Do you see anything remarkable in the DXA log file (set log level to DEBUG if needed)? Did you configure your deployer to store binaries in the database? Commented Mar 6, 2018 at 20:11
  • 1
    Hi Bhawna, Can you please check if the URL works without the tcm id in it? /en/media/myimage.svg If it works, then the Component Template code is not proper at your end, and also can be a case where the image component is getting published with two dynamic CTs. Please confirm if this is happening. Commented Mar 7, 2018 at 5:41

1 Answer 1

1

Many thanks for all of your support.This issue is finally resolved and here is a reference for anybody who will be facing this issue in the future.

The image component was using two Component Template(CT) during publishing(as seen in publish transaction of the successful "Processed Items" )

One was my CT and other was a dynamic one,and hence two image paths were created,one with tcmid (using my template) and other without tcmid (using dynamic one).

Now the issue arises when my template was referencing the path without tcmid returning a 404 not found error, whereas the path without tcmid was available .

So , I changed the source of my template by replacing default setting("Default Dreamweaver Component Design")
with custom DXA("Render Component Content")

Also unpublished my page and then republished it.

Then only one image path with tcmid was created at time of publishing and that was referenced by my CT as well.

Capisce

Your Answer

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

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