This error can creep in:

Notice: Undefined variable: width in _caption_filter_get_width() (line 130 of /usr/local/var/www/commons/profiles/commons/modules/contrib/caption_filter/caption_filter.module).

The trouble here is that _caption_filter_get_width() is called in ways that sometimes it can't figure out the width. This leads to a wierd (100% width caption) even if the image is much smaller.

Comments

inversed’s picture

Issue summary: View changes

While I don't see the error message, the end result for me is that inline styles for the div.caption-inner is being set to width:NANpx.

<div class="caption-inner" style="width: NaNpx;">

This is happening when I apply a caption to an an external image.

hawkeye.twolf’s picture

ergophobe’s picture

There are actually a few issues along these lines that I've seen using Caption Filter with Panopoly. For the time being I'm patching this on the Panopoly end, but some of this could be done more efficiently here.

One of the related issues to this one is that if the caption is really long, it will make the box wider instead of forcing the box to resize to the image size. I am currently handling this with Javascript grabbing naturalWidth.

All the gory details are here:
#2287805: Caption filter does not work with Quarter Size image format - or with floated captions.

I was planning to open an issue in the Caption Filter queue related to this, but perhaps this issue will serve that purpose.

kmonty’s picture

Has anyone patched this? @ergophobe how is this being fixed on Panopoly? I see the js fix on #2287805: Caption filter does not work with Quarter Size image format - or with floated captions.. Definitely open to porting this to Caption Filter....

ergophobe’s picture

Wow, this is gone from the memory banks. I've been off Drupal projects almost since that post, so I really can't help much here.