Für eine Contenido-Version 4.6.23 habe ich ein Bildmodul geschrieben und wollte dies nun in einer 4.8.12 wieder verwenden. Nur, es funktioniert nicht richtig.
Ich poste hier mal einen Codeteil:
Code: Alles auswählen
<?php
// konfig
$MOD_IMG_imgw = "166";
$MOD_IMG_imgh = "332";
$PlatzhalterCMS_IMG = "CMS_IMG[2]";
$PlatzhalterCMS_IMGedit = "CMS_IMGEDIT[2]";
$PlatzhalterCMS_TEXT = "CMS_TEXT[2]";
$MOD_IMG_uploaddir = $cfgClient[$client]['upload'];
$MOD_IMG_uploaddir_4_pregsplit = "{".$MOD_IMG_uploaddir."}";
// ende aller konfig
if ($edit) {
if ("$PlatzhalterCMS_IMG")
{
// cms-img[x] zerlegen
$MOD_IMG_img_split = preg_split("$MOD_IMG_uploaddir_4_pregsplit", "$PlatzhalterCMS_IMG");
$MOD_IMG_img_count = count($MOD_IMG_img_split);
$MOD_IMG_img_rel_path = $MOD_IMG_uploaddir.$MOD_IMG_img_split[$MOD_IMG_img_count -1];
// bildpfade erstellen
$MOD_IMG_htmlpath = $cfgClient[$client]['path']['htmlpath'];
$MOD_IMG_frontendpath = $cfgClient[$client]['path']['frontend'];
$MOD_IMG_img_path = $MOD_IMG_htmlpath.$MOD_IMG_img_rel_path;
$MOD_IMG_img_path_fs = $MOD_IMG_frontendpath.$MOD_IMG_img_rel_path;
//Check configured images
if (strlen($MOD_IMG_img_rel_path) > 0)
{
if (!file_exists($MOD_IMG_img_path_fs))
{
$MOD_IMG_img_path = false;
$MOD_IMG_img_path_fs = false;
}
}
if ($MOD_IMG_img_path_fs)
{
// Scale image
$MOD_IMG_image = capiImgScale($MOD_IMG_img_path_fs, $MOD_IMG_imgw, $MOD_IMG_imgh, false, false, 10, false);
Code: Alles auswählen
echo "MOD_IMG_htmlpath: ".$MOD_IMG_htmlpath."<br />";
echo "MOD_IMG_frontendpath: ".$MOD_IMG_frontendpath."<br />";
echo "MOD_IMG_img_path: ".$MOD_IMG_img_path."<br />";
echo "MOD_IMG_img_path_fs: ".$MOD_IMG_img_path_fs."<br />";
echo "MOD_IMG_image: ".$MOD_IMG_image."<br />";
Ich habe dieses Modul mehrfach eingebunden (Jeweils mit CMS_IMG[3], CMS_IMG[4] usw. ). Interessanterweise wird manchmal das $MOD_IMG_image richtig bestückt, manchmal bleibt es leer. Wenn ich z.B. das CMS_IMG[3] bestückt habe, wird plötzlich auch das vorher bestückte aber nicht angezeigte CMS_IMG[2] auch richtig angezeigt!?
Wo liegt mein Fehler?