This is an old revision of the document!


imgx= (Images from filecenter)

FIXME translate

Forum: http://forum.phpwcms.org/viewtopic.php?p=112248#p112248

Für Bilder gibt es einen speziellen Replacement Tag und in der Dateiverwaltung die einfache ID-Info beim Überfahren der jeweiligen Datei.

Bilder:

[img=ID.FORMAT WxHxCROPxQUALITY]ALT-Text[/img]

verkürzt:

[img=ID.FORMAT WxHxCROPxQUALITY]

Die WxHxCROPxQUALITY sind optional - [W[xH[xCROP[xQUALITY]]]]

Im Prinzip reicht das:

[img=10 100x100]

Zeige Bild mit ID 10 als JPG und verkleinere proportional auf max. 100 Pixel Breite bzw. 100 Pixel Höhe.

Downloads:

    [download=ID1]
    [download=ID1]Caption[/download]
    [download=ID1,ID2,ID3]Caption1
    Caption2
    Caption3[/download]

Tag [imgx=.....]

Die interne Funktion mit – [img=ID.FORMAT WxHxCROPxQUALITY]Title-Text[/imgx] – funktioniert noch nicht (Stand v1.4.0 r286), deshalb wurde die Prozedur von mir temporär nach frontend_render ausgelagert ( /include/inc_front/ext.func.inc.php →function parse_images($matches) ).

Tag: [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]

.FORMAT WxHxCROPxQUALITY ALT-Text Title-Text sind optional -

[.FORMAT [W[xH[xCROP[xQUALITY[ ALT-Text[Title-Text]]]]]]]

rt_imgx.php

<?php
/* ===========================================================================================
   imgx V1.0  03.01.09  K.Heermann (flip-flop) http://planmatrix.de
   -> [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
   The original script in /include/inc_front/ext.func.inc.php  programmed by (c) Oliver Georgi
   03.01.09  patched and swaped out to /frontend_render/* by K.Heermann (flip-flop)
   Forum: http://forum.phpwcms.org/viewtopic.php?p=107263#p107263
 
   Tag:
   [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
   .FORMAT WxHxCROPxQUALITY ALT-Text Title-Text sind optional -
   [.FORMAT [W[xH[xCROP[xQUALITY[ ALT-Text[Title-Text]]]]]]]
 
 
   Have a look into /include/inc_front/ext.func.inc.php ->    function parse_images($matches) { ....
   For me it can´t run.
   I have swaped out and patched this function to /frontend_render/ with the tag:
   [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
============================================================================================= */
 
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------
 
if( strpos($content['all'], '[imgx=') !== FALSE ) {
 
function parse_imagesx($matches) {
// $matches[0] = [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/img]
// $matches[1] = FileID
// $matches[2] = WxHxCROPxQUALITY ALT-Text
// $matches[3] = Title-Text
 
   if(isset($matches[1])) {
 
      // Image file ID
      $img_id    = intval($matches[1]);                      // .FileID
 
      // check for Alt-Text
      $alt         = explode(' ', $matches[2], 3);       // WxHxCROPxQUALITY ALT-Text
// $alt[0] = .FORMAT
// $alt[1] = WxHxCROPxQUALITY
// $alt[2] = ALT-Text
 
      $value      = explode('x', trim(strtolower($alt[1])));
      $alttext   = isset($alt[ 2 ])    ? trim($alt[ 2 ]) : '';      // + kh -> alt text
 
      if(substr($alt[0], 0, 1) == '.') {  // .FORMAT
         $ext   = trim($alt[0]);
      } else {
         $ext   = '.jpg';
      }
 
      $alt      = isset($alt[1]) ? html_specialchars(trim($alt[1])) : ''; // WxHxCROPxQUALITY
 
      $width      = isset($value[ 0 ])  ? intval($value[ 0 ]) : 0;
      $height      = isset($value[ 1 ])  ? intval($value[ 1 ]) : 0;
      $crop         = isset($value[ 2 ]) && intval($value[ 2 ]) === 1 ? 1 : 0;
      $quality   = isset($value[ 3 ])  ? intval($value[ 3 ]) : 0;
 
      $image      = '<img src="'.PHPWCMS_URL.'img/cmsimage.php/'.$width.'x'.$height.'x'.$crop;
      if($quality <= 100 && $quality >= 10) {
         $image .= 'x'.$quality;
      }
      $image      .= '/'.$img_id.$ext.'" alt="'.$alttext.'" border="0"';
      if(isset($matches[3])) {
 
         $title = html_specialchars( preg_replace('/\s+/', ' ', clean_slweg( xss_clean( $matches[3] ) ) ) );
         if($title !== '') {
            $image .= ' title="'.$title.'"';
         }
      }
      $image      .= ' />';
 
      return $image;
 
   }
 
   return '<img src="'.PHPWCMS_URL.'img/leer.gif" alt="" border="0" />';
 
}
 
$content["all"] = preg_replace_callback('/\[imgx=(\d+)(.*?){0,1}\](.*?)\[\/imgx\]/i', 'parse_imagesx', $content["all"]);
$content["all"] = preg_replace_callback('/\[imgx=(\d+)(.*?){0,1}\]/i', 'parse_imagesx', $content["all"]);
 
 
} // end if
 
?>
english/phpwcms_replacer_rts/frontend_render/imgx.1245049443.txt.gz · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0