Seite 1 von 1

auch MySQL-Fehler 1064

Verfasst: Do 29. Jun 2006, 20:44
von Benki
Werte Gemeinde,

ich spreche heut zu euch .... *äh nein*

ich brauch Hilfe. Die Fehlermeldung '1064' kommt ja nun öfter vor und ich hab mir auch schon die Augen wund gelesen, aber ich habe keine Lösung gefunden.

Ich benutze ein Modul von Gerhard Müller 'Bild mit Thumb', welches ich etwas modifiziert habe, dass auch gleich der Berichts-Text mit um das Bild fließt. Dieses Modul habe ich bereits erfolgreich (!) im Einsatz (4.6.4).

Nun wollte ich dies auf einer neuen Seite auch installieren aber dort entstehen Fehler. Im Editor kann ich das Bild auswählen und es wird auch das Thumbnail erzeugt und korrekt abgelegt, aber das eigentliche Bild wird nicht gespeichert. Es wird normaler Weise bei den Standardeinstellungen im Unterverzeichnis thm abgelegt (ist dann das Originalbild in Originalgröße) Dies funktioniert aber nicht. Im Editor wird dann kein Bild angezeigt.

Stattdessen werden Fehler eingetragen:


/contenido/includes/include.backendedit.php?type=CMS_IMG&typenr=1&client=1&lang=1&idcat=9&idart=5&idartlang=5&contenido=5a913d623715b7e68b67f5903e21831e&lang=1 MySQL error 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SELECT * FROM dbname_upl WHERE idclient='1' AND idupl =

contenido/includes/include.backendedit.php?type=CMS_IMG&typenr=1&client=1&lang=1&idcat=9&idart=5&idartlang=5&contenido=5a913d623715b7e68b67f5903e21831e&lang=1 next_record called with no query pending.


Also wenn ich das richtig verstehe, fehlt hinter idupl ein Wert. Vermutlich das Verzeichnis !? Ich habe mir vom Modul den Pfadnamen angeben lassen. Der lautet korrekt auf 'thm' aber wird scheinbar nicht in die DB eingetragen.

Diese Seite läuft auf der 4.6.8.5-Version.

Wo genau wird dieser Befehl ausgeführt, der diesen Fehler verursacht? Oder hat jemand eine konkrete Lösung?

Danke für eure Hilfen vorab.

Benki

Verfasst: Do 29. Jun 2006, 21:01
von HerrB
Nein, da müsste die ID eines Bildes kommen. Hast Du mal einen Link zu dem Modul?

Gruß
HerrB

Verfasst: Do 29. Jun 2006, 21:30
von Benki
hier der Code

Input

Code: Alles auswählen

/*********************************************** 
* CONTENIDO MODUL - INPUT 
* 
* Modulname   :     Bild mit Thumb 
* Author      :     Gerhard Müller 
* Copyright   :     MKO 
* Created     :     4.3.2005 
* Version     :     $Id$ 
* Modified    :     $Date$ 
************************************************/ 

if ( "CMS_VALUE[5]" ) 
{ 
   $thm_dir="CMS_VALUE[5]"; 
} 
else 
{ 
   $thm_dir = defined(THUMB_DIR)? THUMB_DIR: "thm";      // thumb dir - default "thm" 
} 

echo '<table cellspacing="0" cellpadding="10" border="0">'; 

echo '<tr><td>Thumb Verzeichnis (optional):</td>'; 
echo '<td><input type="text" name="CMS_VAR[5]" value="CMS_VALUE[5]" size="30" /></td></tr>'; 

echo '<tr><td>Maximale Breite Thumbs:</td>'; 
echo '<td><input type="text" name="CMS_VAR[6]" value="CMS_VALUE[6]" size="4" />px</td></tr>'; 

echo '<tr><td>Maximale Höhe Thumbs:</td>'; 
echo '<td><input type="text" name="CMS_VAR[7]" value="CMS_VALUE[7]" size="4" />px</td></tr>'; 

echo '<tr><td>Qualität Thumbs (optional):</td>'; 
echo '<td><input type="text" name="CMS_VAR[9]" value="CMS_VALUE[9]" size="3" />%</td></tr>'; 

$align = "CMS_VALUE[10]"; 
$opts = array ( "","absbottom","absmiddle","baseline","bottom","left","middle","right","texttop","top" ); 
echo '<tr><td>Ausrichtung Thumb (optional):</td>'; 
echo '<td><select name="CMS_VAR[10]">'; 
foreach ( $opts as $v ) 
{ 
   $sel = ( $align==$v? "selected": "" ); 
   echo "<option value=\"$v\" $sel>$v</option>"; 
} 
echo '</select></td></tr>'; 

echo "<tr><td>Popup aktivieren:</td>"; 
$pop = "CMS_VALUE[8]"; 
$chk = ( $pop>""? "checked": "" ); 
echo '<td><input type="checkbox" name="CMS_VAR[8]" value="true" size="3" '.$chk.' /></td></tr>'; 

echo "</table>"; 



Output:
<?php 

/*********************************************** 
* CONTENIDO MODUL - OUTPUT 
* 
* Modulname   :     Bild mit Thumb 
* Author      :     Gerhard Müller 
* Copyright   :     MKO 
* Created     :     4.3.2005 
* Version     :     $Id$ 
* Modified    :     08.03.06 by Benki 
************************************************/

   $viewer = "http://www.domain.de/cms/src/viewer.php";  // image viewer for popups 

   $thm_dir = "CMS_VALUE[5]"? "CMS_VALUE[5]": "thm";      // thumb dir - default "thm" 
   $thm_maxw = intval("CMS_VALUE[6]");                   // max width thumb 
   $thm_maxh = intval("CMS_VALUE[7]");                     // max height thumb 
   $thm_qual = "CMS_VALUE[9]"? intval("CMS_VALUE[9]"): 80;   //quality jpeg 
   $show_popup = "CMS_VALUE[8]"? true: false;            // show popup yes/no 
   $align = "CMS_VALUE[10]"? 'align="CMS_VALUE[10]"': "";   // align thumb 

   $img_dir = $cfg['path']['frontend'];                  // base dir frontend 
   $img_src = "CMS_IMG[1]";                              // src of image 
   $img_lnk = "CMS_LINK[1]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[1]";                        // target of imagelink 
    
   $img_url = parse_url($img_src); 
   $img_path = "$img_dir".$img_url['path']; 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
       
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
       
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[1]" ) 
   { 
      echo "CMS_IMGDESCR[1]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[1]" ) 
   { 
      echo "CMS_LINKDESCR[1]"; 
   } 

      echo $thm_dir; //nur test
      echo $thm_path; // nur test
   echo "<p>"."CMS_HTML[10]"."</p>";
?> 

Verfasst: Do 29. Jun 2006, 21:51
von HerrB
Diese Zeile:

Code: Alles auswählen

   $img_path = "$img_dir".$img_url['path'];
Muss so lauten:

Code: Alles auswählen

   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src);
Damit können folgende Zeilen entfallen:

Code: Alles auswählen

   $img_dir = $cfg['path']['frontend'];                  // base dir frontend 
und

Code: Alles auswählen

   $img_url = parse_url($img_src);
Gruß
HerrB

Verfasst: Do 29. Jun 2006, 22:11
von Benki
Wow, wieder mal ne Turbolösung!

Funzt. Der Fehler liegt an der Contenido-Versionsverträglichkeit des Moduls. Nun klappts auch mit 4.6.8.5

Das beste und schnellste Forum, das ich kenne!

Danke

Benki

Verfasst: Mi 4. Okt 2006, 14:25
von jacke
Danke hat mir auch geholfen. Das Modul geht scheinbar in der 4.6.8 aber nicht in der 4.6.8.5.

ich hab das Modul mal für 5 Bilder geändert. Hier der Code für die 4.6.8.5.:

Code: Alles auswählen

/*********************************************** 
* CONTENIDO MODUL - INPUT 
* 
* Modulname   :     Bild mit Thumb 
* Author      :     Gerhard Müller 
* Copyright   :     MKO 
* Created     :     4.3.2005 
* Version     :     $Id$ 
* Modified    :     $Date$ 
************************************************/ 

if ( "CMS_VALUE[5]" ) 
{ 
   $thm_dir="CMS_VALUE[5]"; 
} 
else 
{ 
   $thm_dir = defined(THUMB_DIR)? THUMB_DIR: "thm";      // thumb dir - default "thm" 
} 

echo '<table cellspacing="0" cellpadding="10" border="0">'; 

echo '<tr><td>Thumb Verzeichnis (optional):</td>'; 
echo '<td><input type="text" name="CMS_VAR[5]" value="CMS_VALUE[5]" size="30" /></td></tr>'; 

echo '<tr><td>Maximale Breite Thumbs:</td>'; 
echo '<td><input type="text" name="CMS_VAR[6]" value="CMS_VALUE[6]" size="4" />px</td></tr>'; 

echo '<tr><td>Maximale Höhe Thumbs:</td>'; 
echo '<td><input type="text" name="CMS_VAR[7]" value="CMS_VALUE[7]" size="4" />px</td></tr>'; 

echo '<tr><td>Qualität Thumbs (optional):</td>'; 
echo '<td><input type="text" name="CMS_VAR[9]" value="CMS_VALUE[9]" size="3" />%</td></tr>'; 

$align = "CMS_VALUE[10]"; 
$opts = array ( "","absbottom","absmiddle","baseline","bottom","left","middle","right","texttop","top" ); 
echo '<tr><td>Ausrichtung Thumb (optional):</td>'; 
echo '<td><select name="CMS_VAR[10]">'; 
foreach ( $opts as $v ) 
{ 
   $sel = ( $align==$v? "selected": "" ); 
   echo "<option value=\"$v\" $sel>$v</option>"; 
} 
echo '</select></td></tr>'; 

echo "<tr><td>Popup aktivieren:</td>"; 
$pop = "CMS_VALUE[8]"; 
$chk = ( $pop>""? "checked": "" ); 
echo '<td><input type="checkbox" name="CMS_VAR[8]" value="true" size="3" '.$chk.' /></td></tr>'; 

echo "</table>";

Code: Alles auswählen

<?php 
    
   $viewer = "/awo/js/viewer.php";                           // image viewer for popups 

   $thm_dir = "CMS_VALUE[5]"? "CMS_VALUE[5]": "thm";      // thumb dir - default "thm" 
   $thm_maxw = intval("CMS_VALUE[6]");                   // max width thumb 
   $thm_maxh = intval("CMS_VALUE[7]");                     // max height thumb 
   $thm_qual = "CMS_VALUE[9]"? intval("CMS_VALUE[9]"): 80;   //quality jpeg 
   $show_popup = "CMS_VALUE[8]"? true: false;            // show popup yes/no 
   $align = "CMS_VALUE[10]"? 'align="CMS_VALUE[10]"': "";   // align thumb 


   $img_src = "CMS_IMG[10]";                              // src of image 
   $img_lnk = "CMS_LINK[10]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[10]";                        // target of imagelink 
    
    
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[10]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[10]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[10]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[10]"; 
   } 
   echo "<br>"; 




    ////zweites Bild

$img_dir = $cfg['path']['frontend'];                  // base dir frontend 
   $img_src = "CMS_IMG[11]";                              // src of image 
   $img_lnk = "CMS_LINK[11]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[11]";                        // target of imagelink 
    
   $img_url = parse_url($img_src); 
   $img_path = "$img_dir".$img_url['path']; 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[11]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[11]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[11]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[11]"; 
   } 
   echo "<br>";



////drittes Bild

$img_dir = $cfg['path']['frontend'];                  // base dir frontend 
   $img_src = "CMS_IMG[12]";                              // src of image 
   $img_lnk = "CMS_LINK[12]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[12]";                        // target of imagelink 
    
   $img_url = parse_url($img_src); 
   $img_path = "$img_dir".$img_url['path']; 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[12]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[12]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[12]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[12]"; 
   } 
   echo "<br>";


////viertes Bild

$img_dir = $cfg['path']['frontend'];                  // base dir frontend 
   $img_src = "CMS_IMG[13]";                              // src of image 
   $img_lnk = "CMS_LINK[13]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[13]";                        // target of imagelink 
    
   $img_url = parse_url($img_src); 
   $img_path = "$img_dir".$img_url['path']; 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[13]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[13]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[13]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[13]"; 
   } 
   echo "<br>";


////fünftes Bild

$img_dir = $cfg['path']['frontend'];                  // base dir frontend 
   $img_src = "CMS_IMG[14]";                              // src of image 
   $img_lnk = "CMS_LINK[14]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[14]";                        // target of imagelink 
    
   $img_url = parse_url($img_src); 
   $img_path = "$img_dir".$img_url['path']; 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[14]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[14]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[14]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[14]"; 
   } 
   echo "<br>";
?>

Verfasst: Mi 4. Okt 2006, 14:34
von jacke
Sorry die Ausgabe ist noch falsch - aber jetzt für alle 5 Bilder:
und natürlich die Zeile:
$viewer = "/awo/js/viewer.php"; // image viewer for popups

anpassen

Modulausgabe:

Code: Alles auswählen

<?php 
    
   $viewer = "/XXX/js/viewer.php";                           // image viewer for popups 

   $thm_dir = "CMS_VALUE[5]"? "CMS_VALUE[5]": "thm";      // thumb dir - default "thm" 
   $thm_maxw = intval("CMS_VALUE[6]");                   // max width thumb 
   $thm_maxh = intval("CMS_VALUE[7]");                     // max height thumb 
   $thm_qual = "CMS_VALUE[9]"? intval("CMS_VALUE[9]"): 80;   //quality jpeg 
   $show_popup = "CMS_VALUE[8]"? true: false;            // show popup yes/no 
   $align = "CMS_VALUE[10]"? 'align="CMS_VALUE[10]"': "";   // align thumb 


   $img_src = "CMS_IMG[10]";                              // src of image 
   $img_lnk = "CMS_LINK[10]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[10]";                        // target of imagelink 
    
    
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[10]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[10]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[10]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[10]"; 
   } 
   echo "<br>"; 




    ////zweites Bild


   $img_src = "CMS_IMG[11]";                              // src of image 
   $img_lnk = "CMS_LINK[11]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[11]";                        // target of imagelink 
    
 
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[11]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[11]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[11]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[11]"; 
   } 
   echo "<br>";



////drittes Bild


   $img_src = "CMS_IMG[12]";                              // src of image 
   $img_lnk = "CMS_LINK[12]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[12]";                        // target of imagelink 
    
   
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[12]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[12]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[12]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[12]"; 
   } 
   echo "<br>";


////viertes Bild


   $img_src = "CMS_IMG[13]";                              // src of image 
   $img_lnk = "CMS_LINK[13]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[13]";                        // target of imagelink 
    
   
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[13]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[13]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[13]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[13]"; 
   } 
   echo "<br>";


////fünftes Bild


   $img_src = "CMS_IMG[14]";                              // src of image 
   $img_lnk = "CMS_LINK[14]";                              // image link 
   $img_tgt = "CMS_LINKTARGET[14]";                        // target of imagelink 
    
  
   $img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src); 
   if ( $img_src && file_exists($img_path) ) 
   { 
      unset ($ratio); 
      $img_size = getimagesize ($img_path); 
      if ( $thm_maxw>0 ) 
      { 
         $ratio = $thm_maxw/$img_size[0]; 
         $thm_w = $thm_maxw; 
         $thm_h = round($ratio*$img_size[1]); 
      } 
      if ( $thm_maxh>0 ) 
      { 
         $rh = $thm_maxh/$img_size[1]; 
         $ratio = ( $ratio>$rh? $rh: $ratio ); 
         $thm_w = round($ratio*$img_size[0]); 
         $thm_h = $thm_maxh; 
      } 
      $thm_src = $img_src; 
      if ( is_numeric($ratio) && $ratio<1 ) 
      { 
         // use thumb, resize image 
         $thm_src = dirname($img_src)."/$thm_dir/".basename($img_src); 
         $thm_path = dirname($img_path)."/$thm_dir/".basename($img_path); 
         $flag_create = !file_exists($thm_path); 
         if ( !$flag_create ) 
         { 
            $thm_size = getimagesize ( $thm_path ); 
            if ( !$thm_size || $thm_size[0]!=$thm_w ) 
            { 
               $flag_create = true; 
            } 
         } 
         if ( $flag_create ) 
         { // make thumb 
            if ( !file_exists(dirname($thm_path)) ) mkdir(dirname($thm_path),0777); 
            unset($i); 
            switch ( exif_imagetype($img_path) ) 
            { 
               case IMAGETYPE_GIF: 
                  $i = imagecreatefromgif($img_path); 
                  break; 
               case IMAGETYPE_JPEG: 
                  $i = imagecreatefromjpeg($img_path); 
                  break; 
               case IMAGETYPE_PNG: 
                  $i = imagecreatefrompng($img_path); 
                  break; 
               case IMAGETYPE_BMP: 
                  $i = imagecreatefromwbmp($img_path); 
                  break; 
               case IMAGETYPE_SWF: 
               case IMAGETYPE_PSD: 
               case IMAGETYPE_TIFF_II: 
               case IMAGETYPE_TIFF_MM: 
               case IMAGETYPE_JPC: 
               case IMAGETYPE_JP2: 
               case IMAGETYPE_JPX: 
               case IMAGETYPE_SWC: 
               default: 
                  $i = imagecreatefromxbm($fsrc); 
            } //detect image type 
            if ( $i ) 
            { 
               $thm = imagecreatetruecolor($thm_w,$thm_h); 
               imagecolortransparent($thm,imagecolorat($i,0,0)); 
               imagecopyresampled($thm,$i,0,0,0,0,$thm_w,$thm_h,$img_size[0],$img_size[1]) && 
                  imagejpeg($thm,$thm_path,$thm_qual); 
               imagedestroy($thm); 
               imagedestroy($i); 
            } 
         } // create thumb 
      } // $ratio<1 

      $img =  sprintf('<img src="%s" border="0" %s>',$thm_src,$align); 
        
      $slf = "http://" . $_SERVER['HTTP_HOST'] . dirname($PHP_SELF) . "/"; 
      if ( $img_lnk != "http://" && $img_lnk != $slf ) 
      { 
        $img = sprintf('<a href="%s" target="%s">%s</a>',$img_lnk,$img_tgt,$img); 
      } 
      elseif ( $show_popup ) 
      { 
        $img = sprintf('<a href="%s?img=%s" target="_blank">%s</a>',$viewer,urlencode($img_src),$img ); 
      } 
        
      echo $img; 
   } // $img_src!="" 
    
   if ( $contenido || "CMS_IMGDESCR[14]" ) 
   { 
      echo "<br>"; 
      echo "CMS_IMGDESCR[14]"; 
   } 
   if ( $contenido || "CMS_LINKDESCR[14]" ) 
   { 
      echo "<br>"; 
      echo "CMS_LINKDESCR[14]"; 
   } 
   echo "<br>";
?>

Verfasst: Mi 4. Okt 2006, 14:37
von HerrB
Worin äußerte sich das Problem in der V4.6.8.5?

Gruß
HerrB

Verfasst: Mi 4. Okt 2006, 14:47
von jacke
Hallo,
in der 4.6.8.5. funktioniert alles - nur das Bild ist nicht zu sehen. Die Beschreibung ist da, Bild lässt sich auswählen und abwählen. Es ist nur nicht zu sehen.
Es gibt auch keine Fehlermeldung. Nach den oben beschriebenen Änderungen geht es aber wieder.

jacke

Verfasst: Mi 4. Okt 2006, 15:26
von HerrB
Könntest Du kurz sagen, was Du ändern musstest? Ich habe mir den Code nicht näher angesehen - kurzer Satz genügt ("ging nicht, weil die Funktion a statt b...").

Vielen Dank.

Gruß
HerrB

Verfasst: Mi 4. Okt 2006, 16:34
von jacke
Ich habe genau das gemacht, was du zu diesem Thema am 22.05 geschrieben hast:
Zitat Anfang "

Diese Zeile:
Code:
$img_path = "$img_dir".$img_url['path'];


Muss so lauten:
Code:
$img_path = str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $img_src);


Damit können folgende Zeilen entfallen:
Code:
$img_dir = $cfg['path']['frontend']; // base dir frontend

und
Code:
$img_url = parse_url($img_src);


Gruß
HerrB"

Zitat Ende.

Falls es dann immer noch nicht funzt - mit der Maus aufs Thumb gehen und nachschauen ob der Pfad zum viewer.php stimmt.

Danke und Gruß

jacke