Not a developer? Go to MovableType.com

Plugin and Theme Directory

Custom Asset Markup v0.6.1

By Jay Allen
Posted February 6, 2011, in Design.

Details

The Custom Asset Markup plugin was created to address the issue in Movable Type 4+ where assets embedded into entries are wrapped with HTML markup that is hard coded into MT::Asset and MT::Asset::Image. Having markup hard-coded into the templates presents a number of problems:

  • The markup is not customizable by designers who wish to control the look and feel of embedded assets
  • The markup contains inline CSS styles which, by definition, cannot be overridden by user-developed CSS
  • The markup has been found to be incompatible with a small number of environments, particularly those in tightly controlled corporate Intranets.

This plugin provides administrators with a way to easily and arbitrarily customize the inserted markup via the template system.

Compatibility

Movable Type versions: 4.3


Back

16 Comments

Carlo on July 3, 2008, 1:30 p.m. Reply

Great plugin. I had to go into MTs files before and remove the code by hand. Obviously that was not the best solution, but with this the problem is gone :)

josedante on July 12, 2008, 1:16 p.m. Reply

Hello Jay, Firefox won’t let me access the download page, due to some certificate problems.

Jay Allen on July 12, 2008, 3:12 p.m. Reply

What version of Firefox are you using? I use Firefox as well as do many others who access the site. Do you not get a dialog that asks whether you want to accept the certificate? If not, you may have checked a box in your settings that says to refuse invalid certs without asking.

The cert is self-signed at the moment, because I didn’t feel like shelling out another $500 for another cert. It’s quite safe if that’s what you’re worried about. If I were your bank or something it would be different.

josedante on July 12, 2008, 7:22 p.m. Reply

I’m using Firefox 3 as my default browser. I actually was able to access the download using Internet Explorer 8 already, but thought you would find useful to know that some people may run into this problem. Internet Explorer raises the same concern with the certificate, but does something Firefox doesn’t, which is to provide a link/button to override security this one time.

Firefox just gives me the following alert message:

“trac.endevver.com uses an invalid security certificate.

The certificate is not trusted because it is self signed. The certificate is only valid for trac.strangecode.com

(Error code: secerrorcacertinvalid)”

and then shows me a blank page. One of the many Firefox plugins I’ve installed may be to blame, too.

By the way does your plugin work with MTOS 4.2rc3?

Jay Allen on July 14, 2008, 12:34 a.m. Reply

“Internet Explorer raises the same concern with the certificate, but does something Firefox doesn’t, which is to provide a link/button to override security this one time.”

Correction: “does something which your Firefox 3 browser doesn’t”. :-) I’m using v2 still so I can’t really test it out but I do know that I can make v2 act exactly that way by changing the settings so that it doesn’t ask me about certificates.

However, that is not the default in v2 (maybe it is in v3) and so I get this dialog. When I hit OK, I get the site. The setting is in the advanced tab.

That looks like something I’ll be changing as soon as I get three because that’s just dumb. Self-signed certificates are perfectly valid if you trust the source or if you (as a visitor) don’t really have any sensitive data being transmitted. shrug

Anyway, thanks for the report. I doubt I’m going to change what I’m doing at the moment, but we’ll see about later.

Jay Allen on July 14, 2008, 12:41 a.m. Reply

“By the way does your plugin work with MTOS 4.2rc3?”

Not sure. Haven’t tested it. If you do, let me know if it isn’t.

josedante on July 14, 2008, 10:34 p.m. Reply

My advanced settings are just like your screenshot. Must be a Firefox bug, then, or some mixup with my plugins. Anyway, If it´s not your site’s bug I don’t think you should have to change anything. I, certainly do trust the source and want to use the plugin, which is why I looked for a way around this issue with IE8.

Custom Asset Markup in MTOS 4.2rc3? I’m testing it. first issue. I had to manually create the necessary Global System Template. Haven’t customized yet. I’ll let you know if I run into problems with that.

Jay Allen on July 28, 2008, 8:48 p.m. Reply

v0.6-beta fixes the issue of the custom asset markup global template not being created when you view the global template listings via certain paths.

Sabine on August 15, 2008, 1:44 p.m. Reply

I think there is a bug in plugin Custom Asset Markup 0.6.1-beta.

There is a problem with this plugin and german MT version 4.2-de.

mt:if tag=”AssetType” eq=”image” works in MT version 4.2-en

mt:if tag=”AssetType” eq=”bild” works in MT version 4.2-de

Is that a bug in Movable Type or in plugin Custom Asset Markup?

Jay Allen on August 15, 2008, 6:10 p.m. Reply

Hi Sabine. Unfortunately, there are two problems:

  1. Above you said everything works. Perhaps you meant that one of those didn’t work?
  2. I’m not sure what that has to do with the Custom Asset Markup plugin. The plugin doesn’t modify your code, create or provide any tags or even parse any tags. It simply gives you the ability to define the markup used by MT.

While there may be a bug that you’re encountering, I can’t see any way that it has to do with Custom Asset Markup. Did you try whatever you’re trying to do without the plugin installed?

Sabine on August 16, 2008, 1:58 a.m. Reply

Hi Jay,

The tags works in the respective language version. I can adapt the code exactly as my wish.

But the orginal template customassetmarkup.mtml did not complete work in german MT version.

After the change from mt:if tag=”AssetType” eq=”image” to mt:if tag=”AssetType” eq=”bild” the template work complete.

I was long time to look for reason why the template not complete work.

Maybe it should documented that for other language versions the orginal template customassetmarkup.mtml not complete work. And the use of customassetmarkup-debug.mtml is to be recommended.

The plugin is very flexible and I am very glad to use it.

Beau Smith on June 24, 2009, 12:42 a.m. Reply

Similar to: Assetylene

rover on April 3, 2010, 12:51 p.m. Reply

Hi Jay, Your plugin is great. I know it’s probably not official, but it seems to work ok with MT5. However,I’m trying to track down a possible bug, and am wondering if you could shed some light on if/how Custom Asset Markup would be affecting it. (Perhaps simply a modified “Custom Asset Insertion Markup” template would address it?)

Here are the details:

The MT5 Asset Insertion system is creating duplicate full-sized versions of image assets underneath the /assets_c directory tree. It names these full-sized duplicates with “thumb” in the filename and appends the full sized image resolution to the filename as well.

Additionally, any custom sized thumbnail specified by the user at the time of asset insertion is also being created, but not used in the asset insertion code for thumbnails.
Instead, the asset insertion code calls the full sized duplicate “thumb” and uses html height and width tags to scale it down.

Steps to reproduce:

New Asset. Select file - (my test image is 1920x1275) Choose folder -> /test-images [Upload.]

As expected MT uploads the original asset to /test-images/ and creates a two thumbnails in /assets_c, one 75x75 and one 240x240.

Create New Entry. Insert Image into Entry. Select the Image you just uploaded. [Continue]

In the File Options window, Check [display image in entry/page] Check [Use thumbnail (enter custom width into field eg. 525 pixels) Alignment is arbitrary for this exercise. [Finish]

Again, looking at /assets_c, MT has created three more thumbnails: testimage-thumb-100xauto testimage-thumb-525x348 (my custom thumb as expected) testimage-thumb-1920x1275 (full-sized duplicate of the original)

The image insertion code that is then put in the entry, uses the “thumb-1920x1275” version with html width/height tags to resize it to 525x348.
Instead, it should be calling the native 525x348 version of the thumbnail that it has just created.

I would love to continue using your plugin with all of the other great features in MT5, so any info you could provide about this would be great.

Thanks, Dan

primat on July 7, 2010, 7:55 a.m. Reply

Hi. Indeed a very nice plugin. However, there are a couple oddities…

I discovered by accidient that MT generates thumbnails for assets. the thumbnails filenames contain 75-75 or 240-240 which is misleading since the thumbs don’t actually have these dimensions but are rather scale proportionally so that the larger of the dimenion is scaled to 75 or 240 pixels. I don’t know if this is a result of the plugin or not but it is very unintuitive. Theworst is that I cannot generate a square thumb with 240x240 or 75x75 pixels because MT already created this file and therefore uses that.

More related to the plugin now, I also discovered that the custom markup that is inserted doesn’t always work. MT calls a function after inserting the markup which ‘cleans’ the HTML and sometimes stripping some of it, especially if the asset was not inserted on a new line in the rich text editor. This is a huge drawback but otherwise great plugin. Thanks!

Jason Boychuk on February 4, 2011, 9:16 a.m. Reply

Hi Jay, This plugin appears promising to resolve an issue we deal with such as captioning of photo assets. With this plugin can we customize it to display a photo caption drawing from the tag?

KrL on June 6, 2012, 12:54 a.m. Reply

Hi Jay, the description on how CAM works sounds good for my purposes. I Intend to replace the inline css by a custom solution and furthermore to use the asset description field for a image description as usual on newspapers. There I have some questions: (1) Is CAM working with MT 5.1x? (2) Is it still in maintenance or will it stay at 0.6.1-beta? (3) Where I can get it for testing (the Homepage and Documatation links above are broken) Thanks an regards

Leave a Comment