Finally I solved it Myself!
The problem was that images was not shown when using a "subdirectory" e.g. domain.com/alias1/product1.html because usual img tags use the BASE HREF tag and AlphaImageLoader don’t. The urls were relative to this subdirectory and there is no image file in domain.com/alias1/assets/images/blablabla.png.
I modified the source to read out the base href url and prepend it to the relative path of the image.
Here’s my code:
First a function to get the base url from the document.
(This can be placed anywhere in the code, but I places it just below the switch-statement on top./* Functions for including BASE HREF support */
/* By Qson */
function get_base_href($body=null) {
if ($body==null) {
global $modx;
$body=$modx->documentOutput;
}
preg_match("/<base[^>+]href\s*=\s*([\"'])?(?(1)(.*?)\\1)[^>*]\/?>/is", $body, $matches);
return $matches[2];
}
function add_base_href($url) {
global $base_href;
if (!isset($base_href)||empty($base_href)){
$base_href=get_base_href();
}
/* If the url is neither absolute (begins with http:// or ftp://) nor relative to root (begins with a slash) */
if( preg_match('/^((http|ftp)\:\/\/|[\/\\\]).*/is',$images[3][$num_images])==0) {
// The url is relative to this directory, let's prepend the base href
return $base_href . $url;
} else {
// The url is absolute or root relative. Just return it as is.
return $url;
}
}
/* End of Qson Functions */
At the bottom of the source:
Replace the following:
// end quote is already supplied by originial src attribute
$replace_src_with=$quote.$img_path.'spacer.png'.$quote.' style="width: '.$width.
'; height: '.$height.'; filter: progid:DXImageTransform.'.
'Microsoft.AlphaImageLoader(src=\''.$images[3][$num_images].'\', sizingMethod='.
$sizeMeth.');"';
with
// end quote is already supplied by originial src attribute
$replace_src_with=$quote.$img_path.'spacer.png'.$quote.' style="width: '.$width.
'; height: '.$height.'; filter: progid:DXImageTransform.'.
'Microsoft.AlphaImageLoader(src=\''.add_base_href($images[3][$num_images]).'\', sizingMethod='.
$sizeMeth.');"';