开发者

How do you link to a media item by ID outside Zotonic?

The creative team wants to be able to use Zotonic to manage images used outside of the main website. In order to do this they are currently linking to images as follows:

<img src="http://example.com/media/inline/2010/10/29/image.jpg" />

This has a huge flaw. Every time an one of these images is replaced in Zotonic the filename can change. If the replacement happens on a different day the path to the file changes. This means that they have to replace the image in Zotonic and then update the HTML on the other sites as well.

Imagine that the Media item in question has ID 575. I would like to let them link to images as follows:

<img src="http://开发者_开发问答example.com/media/575" />

How do you link to a media item by ID outside Zotonic?


After reading your question I made a small change to the resource_file_readonly and added two dispath rules:

{media_attachment, ["media","attachment","id",id], ... },
{media_inline, ["media","inline","id",id], ... }

Which allows an image tag like:

<img src="http://example.com/media/inline/id/575" />

This change is now available on the tip of the default branch (0.6-dev).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜