imgx= (Images from filecenter)

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

For pictures there is a special replacement tag using the UD info from filecenter when over driving the respective file.

Images:

[img=ID.FORMATxWxHxCROPxQUALITY ALT-text]TITLE-text[/img]

shorted:

[img=ID.FORMATxWxHxCROPxQUALITY]

WxHxCROPxQUALITY are optional - [W[xH[xCROP[xQUALITY] [Alt-text]]]] Basically this is enough:

[img=10x100x100]

Show a picture with ID 10 as JPG and shrink it proportionally to max. 100 pixels width and/or 100 pixels height.

Downloads:

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

wird nicht mehr gebraucht

Tag [imgx=.....] - is not no more used

The internal function with – [img=ID.FORMAT WxHxCROPxQUALITY]Title-text[/imgx] – functioned not yet (v1.4.0 r286), therefore the procedure was outsourced by me temporarly to frontend_render ( /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 are 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.txt · Last modified: 2018/06/03 18:09 (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