1

I have Static Resources whose content points to image files uploaded through ModX content manager. I created JPG and PNG content types and have set it to the Static Resource along with Content disposition Inline.

My goal is to display the images with the help of a plugin/chunk.

The plugin looks like:

$adds = $modx->getCollection('modResource', array('parent'=>44));
$output = "";
foreach ($adds as $add) {
  $properties = $add->toArray();
  $properties['base_url'] = $modx->getOption('base_url');
  $output .= $modx->getChunk('advertisement', $properties);
}
return "<div id='add-slider-wrapper'><div id='add-slides'><ul class='add-slides-container'>" . $output . "</ul></div></div>";

And my 'advertisement' chunk:

<li>
  <a href="[[+description]]">
    <img src="[[+base_url]][[+content]]" alt="" />
  </a>
</li>

However this is not working. Here is what ModX outputs for a static resource:

<img src="/huayang/Images/Advertisements/04.jpg" alt="" width="0" height="0" style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 1px 1px;">

Why does it add those inline styles?

Besides, I can see in the network tab that something is wrong, see the screenshots below:

enter image description here enter image description here

What am I doing wrong?

fkoessler
  • 6,932
  • 11
  • 60
  • 92
  • Might be some JS adding the styles. I'd rule that out first. – Phil Mar 31 '14 at 04:55
  • It is indeed JS adding the styles. But still the same problem without JS: the image file isn't downloaded (same thing happens as shown in screenshots) – fkoessler Mar 31 '14 at 05:25

1 Answers1

0

It was AdBlock blocking the images download because of "Advertisements" in the files' path! It was adding the inline styles as well.

This post helped me find this out..

Community
  • 1
  • 1
fkoessler
  • 6,932
  • 11
  • 60
  • 92