{{indexmenu_n>760}}
====== FCKeditor: Bilder aus der Dateizentrale ======
====== FCK Editor in Artikeln und CPs ======
===== V1.0: Thumb cropping & LightBox =====
##**Nur für den FCK Editor verfügbar!!** (seit V1.4.2 r308 (07.03.2009)##
**Kurze Beschreibung:** \\
Basiert auf einer neuen experimentellen Funktion um Bilder aus der Dateizentrale im FCK WYSIWYG-Editor in CPs zu verwenden. Die Höhen/Breiten-Bildparameter aus dem FCK-Editor werden in die hier verwendete Funktion image_resized.php autom. eingesetzt und in die Funktion cmsimage.php übertragen. \\
**Siehe auch:** \\
- [[deutsch/andere-erweiterungen/fck-dateizentrale]] \\
- [[deutsch/ersetzer_rts/frontend_init/cp_trigger/wysiwyg-image-resize]]
\\
* LightBox (System integriert)
* Thumb cropping
* Ein vor/zurück Schalter für die LightBox
* Bildpositionierung mit dem Mauszeiger möglich
* Bildgrößenänderung mit dem Mauszeiger möglich
* **V1.1 Update 25.10.2011**:
* LightBox partiell im Editor ausschalten: Parameter "xnolight"
* Cropping partiell im Editor ausschalten: Parameter "xnocrop"
Diese Technik funktioniert **ausschließlich im FCK-Editor**, **nicht** im CK-Editor. \\
Diese Technik funktioniert im FCK-Editor und im CK-Editor. \\
Und **ist nicht für** die Erstellung von **Galerien** gedacht!!
----
\\
**Docu:** http://code.google.com/p/phpwcms/source/detail?r=308 \\
//"FCKEditor got support for phpwcms file browser. Use new setting $phpwcms['FCK_FileBrowser'] = 1 in conf.inc.php to enable it (thanks Markus Köhl for idea and code)."//\\
**Forum:** -- \\
**Autor:** K.Heermann (flip-flop) http://planmatrix.de //2010/06/25 // \\
**CMS-Version:** >= V1.4.2 r308 (07.04.2009) \\
**Version:** V1.0 //2010/06/25// \\
**Update:** V1.1 //2011/10/25// \\
**Tag:** --
**Bedingungen:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\
* $phpwcms['allow_ext_render'] = 1;
* $phpwcms['FCK_FileBrowser'] = 1;
----
----
\\
==== Setupschalter direkt in der Datei rt_wysiwyg_cmsimage.php: ====
Im Bereich **%%*** CUSTOM VAR ***%%** etwa ab Zeile 40:
* **$quality = 85;** //%%// Eigener Qualitätsparameter oder aus der conf.inc.php%%//
* **$cmsimage = 1;** //%%// simple image_resized = 0 <-> img/cmsimage = 1%%//
* **$xcrop = 0;** //%%// [0|1] Bild zuschneiden%%//
* **$xlightbox = true;** //%%// Verwende immer die LightBox = true%%//
* **$xnextprev = true;** //%%// [true|false] vor/zurück anzeigen, wenn mehr als ein Bild verfügbar ist%%//
==== Setupschalter im Editor: ====
* **V1.1 Update 25.10.2011**: 2 Parameter in "Bild einfügen/editieren" -> "Erweitert" -> "Stylesheet Klasse" hinzugefügt [xnolight xnocrop]
* LightBox partiell im Editor ausschalten: Parameter "xnolight"
* Cropping partiell im Editor ausschalten: Parameter "xnocrop"
\\
==== Frontend-Ausgabe ====
Unterschied zur Ausgabe mit cmsimage.php //(Bild wird neue gerechnet)//.
{{:deutsch:ersetzer_rts:frontend_render:wysiwyg_cmsimage_fe01_1.gif|}}
\\
==== Backend-Ausgabe ====
**Backend:** Bild-Eigenschaften\\
{{:deutsch:ersetzer_rts:frontend_render:wysiwyg_cmsimage_be01_1.gif|}}
\\
**Update V1.1:** In Bild-Eigenschaften: "xnolight" und "xnocrop"
{{:deutsch:ersetzer_rts:frontend_render:fck_image_resize03_1.gif|}}
\\
=== PHP V1.0: ===
**Version:** V1.0 //2010/06/25// \\
**Dateiname:** rt_wysiwyg_cmsimage.php \\
**Verzeichnis:** template/inc_script/frontend_render/ \\
**Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\
* %%$phpwcms['allow_ext_render'] = 1; // allow including of custom external scripts at frontend rendering%%
* %%$phpwcms['FCK_FileBrowser'] = 1; // enable|disable phpwcms Filebrowser in FCKeditor instead of built-in FCK file bowser support%%
\\
cmsimage.php_
V1.0 25.06.10 K.Heermann (flip-flop) http://planmatrix.de
Since phpwcms V1.4.2 r308 (07.04.2009)
Based on the new experimental function for using filecenter images with the fck wysiwyg editor.
-> http://code.google.com/p/phpwcms/source/detail?r=308
"FCKEditor got support for phpwcms file browser. Use new setting
$phpwcms['FCK_FileBrowser'] = 1 in conf.inc.php to enable it (thanks Markus Köhl
for idea and code)."
The height/widht paramters from fck are injected into the used function image_resized.php
(with jpg quality declared in conf.inc.php)
*********************************************************************************************/
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
// ========================================================================
// Search for all image strings between ""
$content['all'] = preg_replace_callback("//", "image_resize_to_cmsimage" , $content['all']);
// ========================================================================
function image_resize_to_cmsimage($img_tag) {
if (strpos($img_tag[1],'image_resized.php')) { // image_resized.php available?
/********************** CUSTON VAR *************************************
Switches for own JPG quaility, generally function call and generally LightBox
- simple image_resized without file storage (low rendered img qualitiy)
- img/cmsimage with rendered file stored in content/images/* (better quality)
**********************************************************************/
// Switch between quality parameter from config or your own one
$quality = 85; // default
// $my_quality = $GLOBALS['phpwcms']['jpg_quality'];
// The image quality generated by image_resized is very crappy
// Switch between simple image_resized = 0 <-> img/cmsimage = 1
$cmsimage = true;
$xcrop = 0; // [0|1] crop the image
// Using the LightBox generally
$xlightbox = true; // [true|false]
// Next / Prev in LightBox if there more than one image
$xnextprev = true; // [true|false]
// 1. Dimensions adjusted in fck image attributes: e.g. height="150" width="200"
// 2. Dimensions adjusted direct using the computer mouse: e.g. style="width: 200px; height: 150px;"
/**********************************************************************/
preg_match_all('/((height="|height: )(\d+)("|px))|((width="|width: )(\d+)("|px))|filearchive\/([a-fA-F0-9]{32}).([jJpPeEgGnNiIfF]{3,4})"/', $img_tag[1], $temp); // "fck height/width" search and save in $temp[3]/[7] = value
// Set search- and replacer
//kh Wird erwartet:
//kh Alte Version: $search = '#image_resized\.php\?format\=(.*?)\&q\=(.*?)\&imgfile\=filearchive/(.*?)" #';
$search = '#image_resized\.php\?format\=(.*?)\&q\=(.*?)\&imgfile\=filearchive/([a-fA-F0-9]{32}).([jJpPeEgGnNiIfF]{3,4})"#';
$width = implode($temp[7]); // FCK image width
$height = implode($temp[3]); // FCK image height
$image[1] = implode($temp[9]); // Filecenter hash name
$image[2] = implode($temp[10]); // Filecenter hash extend
$img_wrap = array();
$temp = '';
if (empty($cmsimage)) { // using simple image_resized without stored files?
$replace = 'image_resized.php?format=$1'.'&w='.$width.'&h='.$height.'&q='.$quality.'&imgfile=filearchive/$3.$4" ';
}
else { // ====== No,we uses cmsimage
// and there we have some paramaters concealed in class names
$title = preg_match('/title\="(.*?)"/i',$img_tag[1], $g) ? html_specialchars($g[1]) : '' ; //
// ====== LIGHTBOX ?? Set
if ($xlightbox) {
$xnextprev = ($xnextprev) ? '[xyz]':'';
$img_wrap['begin'] = '';
$img_wrap['end'] = '';
if (isset( $GLOBALS['phpwcms']['release_date']) AND $GLOBALS['phpwcms']['release_date'] > '2009/11/23') // V1.4.3 r380
initslimbox();
else
initializeLightbox(); // start mootools and slimbox
} // LightBox END ======
// ====== Thumb with width/height and crop from FCK
//kh Wird erwatet: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT%
$replace = 'img/cmsimage.php/'.$width.'x'.$height.'x'.$xcrop.'x'.$quality.'/$3.$4" ';
} // END cms_image
$img_tag[0] = $img_wrap['begin'] . preg_replace($search, $replace, $img_tag[0]) . $img_wrap['end'];
} // End function
return $img_tag[0];
}
?>
\\
=== PHP V1.1: ===
**Version:** V1.1 //2011/10/25// \\
**Dateiname:** rt_wysiwyg_cmsimage.php \\
**Verzeichnis:** template/inc_script/frontend_render/ \\
**Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\
* %%$phpwcms['allow_ext_render'] = 1; // allow including of custom external scripts at frontend rendering%%
* %%$phpwcms['FCK_FileBrowser'] = 1; // enable|disable phpwcms Filebrowser in FCKeditor instead of built-in FCK file bowser support%%
\\
cmsimage.php_
V1.0 25.06.10 K.Heermann (flip-flop) http://planmatrix.de
Since phpwcms V1.4.2 r308 (07.04.2009)
Based on the new experimental function for using filecenter images with the fck wysiwyg editor.
-> http://code.google.com/p/phpwcms/source/detail?r=308
"FCKEditor got support for phpwcms file browser. Use new setting
$phpwcms['FCK_FileBrowser'] = 1 in conf.inc.php to enable it (thanks Markus Köhl
for idea and code)."
The height/widht paramters from fck are injected into the used function image_resized.php
(with jpg quality declared in conf.inc.php)
V1.1 25.10.2011 KH: Update
**********************************************************************
// FCK -> images -> enhanced -> style sheet class:
// Classes separated with blanks
// - xnolight = lightbox off (if set generally to on)
// - xnocrop = crop thumb off (if set generally to on)
// e.g. xnocrop xnolight -> using Thumb no cropping and no LightBox
**********************************************************************
*********************************************************************************************/
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
// ========================================================================
// Search for all image strings between ""
$content['all'] = preg_replace_callback("//", "image_resize_to_cmsimage" , $content['all']);
// ========================================================================
function image_resize_to_cmsimage($img_tag) {
if (strpos($img_tag[1],'image_resized.php')) { // image_resized.php available?
/********************** CUSTON VAR *************************************
Switches for own JPG quaility, generally function call and generally LightBox
- simple image_resized without file storage (low rendered img qualitiy)
- img/cmsimage with rendered file stored in content/images/* (better quality)
**********************************************************************/
// Switch between quality parameter from config or your own one
$quality = 85; // default
// $my_quality = $GLOBALS['phpwcms']['jpg_quality'];
// The image quality generated by image_resized is very crappy
// Switch between simple image_resized = 0 <-> img/cmsimage = 1
$cmsimage = true;
$xcrop = 0; // [0|1] crop the image
// Using the LightBox generally
$xlightbox = true; // [true|false]
// Next / Prev in LightBox if there more than one image
$xnextprev = true; // [true|false]
// 1. Dimensions adjusted in fck image attributes: e.g. height="150" width="200"
// 2. Dimensions adjusted direct using the computer mouse: e.g. style="width: 200px; height: 150px;"
/**********************************************************************/
preg_match_all('/((height="|height: )(\d+)("|px))|((width="|width: )(\d+)("|px))|filearchive\/([a-fA-F0-9]{32}).([jJpPeEgGnNiIfF]{3,4})"/', $img_tag[1], $temp); // "fck height/width" search and save in $temp[3]/[7] = value
// Set search- and replacer
//kh Wird erwartet:
//kh Alte Version: $search = '#image_resized\.php\?format\=(.*?)\&q\=(.*?)\&imgfile\=filearchive/(.*?)" #';
$search = '#image_resized\.php\?format\=(.*?)\&q\=(.*?)\&imgfile\=filearchive/([a-fA-F0-9]{32}).([jJpPeEgGnNiIfF]{3,4})"#';
$width = implode($temp[7]); // FCK image width
$height = implode($temp[3]); // FCK image height
$image[1] = implode($temp[9]); // Filecenter hash name
$image[2] = implode($temp[10]); // Filecenter hash extend
$img_wrap = array();
$temp = '';
if (empty($cmsimage)) { // using simple image_resized without stored files?
$replace = 'image_resized.php?format=$1'.'&w='.$width.'&h='.$height.'&q='.$quality.'&imgfile=filearchive/$3.$4" ';
}
else { // ====== No,we uses cmsimage
// and there we have some paramaters concealed in class names
$title = preg_match('/title\="(.*?)"/i',$img_tag[1], $g) ? html_specialchars($g[1]) : '' ; //
// -------------------- V1.1 Update 25.10.2010 KH +xnocrop +xnolight
// === catch the classes and sort if xnp ist set
$class_temp = preg_match('/class="(.*?)"/i',$img_tag[1], $g) ? trim($g[1]) : ''; // cut out all class names
$temp = explode(' ', $class_temp);
asort($temp);
if ($xlightbox)
$xlightbox = (in_array('xnolight', $temp))? false : true;
if ($xcrop)
$xcrop = (in_array('xnocrop', $temp))? 0 : 1;
// -------------------- End V1.1 Update
// ====== LIGHTBOX ?? Set
if ($xlightbox) { // only do if lightbox ist true and xnolight isn´t set.
$xnextprev = ($xnextprev) ? '[xyz]':'';
$img_wrap['begin'] = '';
$img_wrap['end'] = '';
if (isset( $GLOBALS['phpwcms']['release_date']) AND $GLOBALS['phpwcms']['release_date'] > '2009/11/23') // V1.4.3 r380
initslimbox();
else
initializeLightbox(); // start mootools and slimbox
} // LightBox END ======
// ====== Thumb with width/height and crop from FCK
//kh Wird erwatet: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT%
$replace = 'img/cmsimage.php/'.$width.'x'.$height.'x'.$xcrop.'x'.$quality.'/$3.$4" ';
} // END cms_image
$img_tag[0] = $img_wrap['begin'] . preg_replace($search, $replace, $img_tag[0]) . $img_wrap['end'];
} // End function
return $img_tag[0];
}
?>
\\
===== Historie =====
**Version:** \\
* **V1.0.0** //25.06.10// : + Basic stuff
* **V1.1.0** //25.10.11// : + LightBox und Cropping durch Parameter "xnolight" und "xnocrop" in "Stylesheet Klasse" partiell ausschaltbar wenn durch Script permanent eingeschaltet. \\