WYSIWYG2 mit Bildresize Content 1.0 1 1091618748 1094289057 1 Alle Bilder, die "popup" im alt-TAG stehen haben, werden resized und durch eine Popup-Funktion ersetzt. Der Bildtitel, der im Dateimanager angegeben wurde wird im Popupfenster angezeigt. <?PHP // Bearbeitungsmodus? if ($dedi_side['edit']) { echo <dedi:mod type="wysiwyg2" id="1" addslashes="true">; } else { $mod['output'] = <dedi:mod type="wysiwyg2" id="1" addslashes="true">; // Bild resizen if (!function_exists('make_watermark_image')) { function make_watermark_image($image, $watermarkfile, $new_image, $x, $y, $transition) { global $cfg_dedi, $cfg_client; require_once $cfg_dedi['dedi_path'].'external/pear/image/transform.php'; $dedi_image = Image_Transform::factory($cfg_dedi['image_mode']); $dedi_image->load($image); if ($x != $dedi_image->img_x || $y != $dedi_image->img_y) $dedi_image->resize($x, $y); $watermark = imagecreatefromstring(base64_decode($watermarkfile)); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $watermark_x = $x-($watermark_width+5); $watermark_y = $y-($watermark_height+5); imagecopymerge($dedi_image->imageHandle, $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height, $transition); $dedi_image->save($new_image); $dedi_image->free(); unset($dedi_image); } } // Bilddaten filtern preg_match_all("/<img[^>]*? alt=[\"\']?popup[\"\']?[^>]*?>/i", $mod['output'], $mod['matches1']); $mod['tag_count'] = 0; if (is_array($mod['matches1'][0])) { foreach($mod['matches1'][0] as $mod['imagetag']){ preg_match_all('/(height|src|width)=["\']?(.*?)["\']?[ >]/i',$mod['imagetag'],$mod['matches2'],PREG_SET_ORDER); foreach($mod['matches2'] as $mod['match']) $mod['images'][$mod['tag_count']][$mod['match'][1]] = $mod['match'][2]; $mod['images'][$mod['tag_count']]['tag'] = $mod['imagetag']; $mod['tag_count']++; } } // Bilder generieren $mod['folder'] = str_replace($cfg_client['htmlpath'], '', $cfg_client['upl_htmlpath']); if (is_array($mod['images'])) { foreach($mod['images'] as $mod['image']) { // Bildpfad relativieren $mod['image']['subfolder'] = str_replace($cfg_client['upl_htmlpath'], '', $mod['image']['src']); // Bild in Bildpfad und Bildendung teilen $mod['image']['filename'] = substr(strrchr($mod['image']['subfolder'], '/'), 1); $mod['image']['subfolder'] = str_replace($mod['image']['filename'], '', str_replace($mod['folder'], '', $mod['image']['subfolder'])); // Originalbild suchen $sql = "SELECT pictwidth, pictheight, titel, B.description, filetype FROM ".$dedi_db['directory']." A LEFT JOIN ".$dedi_db['upl']." B USING(iddirectory) LEFT JOIN ".$dedi_db['filetype']." C USING(idfiletype) WHERE dirname='".$mod['image']['subfolder']."' AND filename='".$mod['image']['filename']."' LIMIT 0, 1"; $db->query($sql); if ($db->next_record()) { // Dateiendung entfernen $mod['image']['name'] = str_replace('.'.$db->f('filetype'), '', $mod['image']['filename']); // neue Dateinamen $mod['image']['file'] = $mod['folder'].$mod['image']['subfolder'].$mod['image']['filename']; $mod['image']['file_resize'] = $mod['folder'].$mod['image']['subfolder'].$mod['image']['name'].$cfg_client['thumbext'].'_'.$mod['image']['width'].'x'.$mod['image']['height'].'.'.$db->f('filetype'); $mod['image']['file_popup'] = $mod['folder'].$mod['image']['subfolder'].$mod['image']['name'].$cfg_client['thumbext'].'_'.$db->f('pictwidth').'x'.$db->f('pictheight').'.'.$db->f('filetype'); // verkleinertes Bild generieren? if (!@file_exists($cfg_client['path'].$mod['image']['file_resize'])) { make_watermark_image($cfg_client['path'].$mod['image']['file'], 'iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAAB3RJTUUH1AgDFTAwhMx3cgAAAAlwSFlzAAAewgAAHsIBbtB1PgAAAARnQU1BAACxjwv8YQUAAAAJUExURf///wAAAPf397b+3M0AAAABdFJOUwBA5thmAAAAPElEQVR42mWOQRIAIAgCWf//6LSJtImTO4gopQBZEBHmmktcwrQtbFIZKsvnvbm+yezryhzoD05iUG5oAT1KAKIf0BVOAAAAAElFTkSuQmCC', $cfg_client['path'].$mod['image']['file_resize'], $mod['image']['width'], $mod['image']['height'], 80); } // Popupbild generieren? if (!@file_exists($cfg_client['path'].$mod['image']['file_popup'])) { make_watermark_image($cfg_client['path'].$mod['image']['file'], 'iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAAB3RJTUUH1AgECQgO2tm0jwAAAAlwSFlzAAAewQAAHsEBw2lUUwAAAARnQU1BAACxjwv8YQUAAAMAUExURf///wAAAPf39wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMn6z+cAAAABdFJOUwBA5thmAAAAOUlEQVR42nWO0QoAMAgCvf7/o5dsURDzyaPMpBSgEkREsb3FpoKLOIOzrNnvCrOvK9PQH7zEoNzQAT7yAKaZKZ1UAAAAAElFTkSuQmCC', $cfg_client['path'].$mod['image']['file_popup'], $db->f('pictwidth'), $db->f('pictheight'), 80); } // Bild durch neues Bild ersetzen $mod['output'] = str_replace($mod['image']['tag'], '<a href="javascript:new_imagepopup(\''.$mod['image']['file_popup'].'\',\''.htmlspecialchars($db->f('titel')).'\',\'Fenster schliessen\',\'\',\''.$db->f('pictwidth').'\',\''.$db->f('pictheight').'\',\'true\')" onMouseOver="on(\'Klicken Sie hier für eine Detailansicht\');return true;" onMouseOut="off();return true;"><img src="'.$mod['image']['file_resize'].'" width="'.$mod['image']['width'].'" height="'.$mod['image']['height'].'" alt="Klicken Sie hier für eine Detailansicht"></a>', $mod['output']); } } } echo $mod['output']; } ?> mod:ec8108dc93a26f333113812467b71188:ca0ad905