?
Solved

In PHP how do I make an array and save values generated on the fly?

Posted on 2011-05-03
14
Medium Priority
?
973 Views
Last Modified: 2012-05-11
I have a plugin for joomla which loads image icons from a folder and then onClick shows a shadowboxed enlarged version of the same image with description below. I have custom hacked to display the download hi-res / print / add to facebook / add to twitter and send link via email.

At first I had some problems with the long urls this code generates on the fly which could not be added to Facebook or Twitter. So I used a bit.ly api query script which generates short URLs on the fly for each image in each gallery. Everything works fine but there is only one problem. Everytime I load a gallery page (I have several different gallery pages in a section) it takes a real long time for the page icons to load (without the bit.ly script it loads instantaneously). I believe that somehow my code asks bit.ly to send all the shortened URLs immediately and until it receives all of them it does not show my icons. Once the icons load everything works fast again. Also if I immediately reload a page after all its icons have already loaded, it makes me wait a real long time all over again.

Perhaps the solution could be that somewhere in my code I should do this:
1) for each session for each gallery that loads create an array (per gallery) on the fly and in each array save all the urls that it generates right at the start of the code

2) if I reload a gallery whose array exists already and is already full, I need it to bypass the part where it consults bit.ly and load the gallery right away

3) create a graphic preloader which keeps the end user occupied while the array is populated and icons are loaded per gallery


Could anyone please help me modify my code to do this?

The bit.ly specific code is here (you will find it at the start of my sige.php file which I am attaching here - this file runs the gallery code and contains the below code too):
function make_bitly_url($url,$login,$appkey,$format = 'xml',$version = '2.0.1')
	{
	  //create the URL
	  $bitly = 'http://api.bit.ly/shorten?version='.$version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='.$appkey.'&format='.$format;
	  
	  //get the url
	  //could also use cURL here
	  $response = file_get_contents($bitly);
	  
	  //parse depending on desired format
	  if(strtolower($format) == 'json')
	  {
		$json = @json_decode($response,true);
		return $json['results'][$url]['shortUrl'];
	  }
	  else //xml
	  {
		$xml = simplexml_load_string($response);
		return 'http://bit.ly/'.$xml->results->nodeKeyVal->hash;
	  }
	}

//and later on in my php I call this code via:
$url = ($mosConfig_live_site."/plugins/content/sige/plugin_sige/socialshare.php?img=".$mosConfig_live_site.$rootfolder.$_images_dir_."/Midsize/".$images[$a]['filename']."&name=".$imagename);
$u = make_bitly_url($url,'badwolfff','R_f650e553b78bb0569fc67dbc16a5de7c','json');

Open in new window


Also I am attaching the original Sige plugin for Joomla 1.6 download from their own website.
Alternatively you could download it from their site:
Sige Plugin for Joomla! 1.6

You may test the working of my plugin on my test/debug site:
Test/debug site
(click on the link "SOLUZIONI D'ARREDO" at the top and then select the different gallery categories from the large buttons on the left in that section.

thanks in advance
0
Comment
Question by:badwolfff
14 Comments
 
LVL 6

Expert Comment

by:hexer4u
ID: 35684271
Indeed, becuase you use file_get_contents(), you have to wait for a response each time it's called. I would suggest the following, and in my opinion it's the best sollution:
Create a new table in the database with the following fields: "url_before" (varchar 255 or text), "url_after" (varchar 140)
Now, in your code before you do $bitly = 'http://api.bit.ly/shorten?version='.$version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='.$appkey.'&format='.$format;
Make a select in the database for the $url in "url_before". If you find it, then use the corresponding "url_after" and then return $url_after, before doing file_get_contents();
If you don't find it, after generating the new url add it to the table, so the next time it will exist.

This is called mysql caching.
0
 
LVL 6

Expert Comment

by:Mike D
ID: 35688319
Or you might want to consider ditching the whole bit.ly process and shortening your URLs yourself using url-rewrite and the database...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:badwolfff
ID: 35693361
Dear leakim971,
thanks for the suggestions. I checked them all out. The last one is very interesting where I found Free PHP URL shortener which sounds great but I am still having trouble setting up (I have contacted the author for a solution). Also Phurl sounds great and I will test it tonight.
Thanks again - hope at least one works!
0
 

Author Comment

by:badwolfff
ID: 35693383
Dear hexer4u,

Thanks for your reply. I believe that what you are suggesting will make the whole gallery section load very fast indeed. Could you please give me a more detailed example of working code. Unfortunately I am not a PHP programmer and have particularly low experience with SQL queries.

Your help will be most appreciated.

thanks again
0
 

Author Comment

by:badwolfff
ID: 35693404
Dear Johndoeherty,

thanks for the reply. You say:
 
Or you might want to consider ditching the whole bit.ly process and shortening your URLs yourself using url-rewrite and the database...

Open in new window


Could you please elaborate. As I have mentioned above to hexer4u I am not a PHP programmer so I don't really know how to code it.

thanks again
0
 
LVL 6

Accepted Solution

by:
hexer4u earned 2000 total points
ID: 35693519
Well, first you will need to create a table, let's call it url_cache, and assuming you use Mysql, here's the code to create the table

CREATE TABLE `test`.`url_cache` (
`before` VARCHAR( 255 ) NOT NULL ,
`after` VARCHAR( 140 ) NOT NULL ,
INDEX ( `before` )
) ENGINE = MYISAM ;

Open in new window

Now, inside your make_bitly_url function, before the //create URL
do the following
$sql = "SELECT * FROM `url_cache` WHERE `before`='".mysql_real_escape_string($url)."' LIMIT 1";
$check = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($check)==1){//we found it in cache
$url = mysql_fetch_assoc($check);
return $url['after];
}

Open in new window

Now, right before  
return $json['results'][$url]['shortUrl']; 

Open in new window

add
$sql = "INSERT INTO `url_cache` SET `before`='".mysql_real_escape_string($url)."', `after`='".mysql_real_escape_string($json['results'][$url]['shortUrl'])."'";
mysql_query($sql) or die(mysql_error());

Open in new window


and before
return 'http://bit.ly/'.$xml->results->nodeKeyVal->hash;

Open in new window

add
$sql = "INSERT INTO `url_cache` SET `before`='".mysql_real_escape_string($url)."', `after`='".mysql_real_escape_string('http://bit.ly/'.$xml->results->nodeKeyVal->hash;)."'";
mysql_query($sql) or die(mysql_error());

Open in new window


It should work from the start assuming you have sql connection and database selected. If not, read this http://php.net/manual/en/function.mysql-connect.php and this http://php.net/manual/en/function.mysql-select-db.php
0
 

Author Comment

by:badwolfff
ID: 35694007
Hi Hexer4u,

The first part of your code related to the MySQL database which I tried to add to my database on my ISP's custom PHPMyadmin panel and I got the following error:
#1142 - CREATE command denied to user 'Sql421655'@'62.149.150.254' for table 'url_cache'

How could I create this table manually and add the values you suggest manually to it? (I am assuming that is the way to add them to the database if the ISP is not allowing me to install your script, right?)
Or perhaps could I do this through my php gallery script (sige.php from my original post)?

thanks in advance
0
 
LVL 6

Expert Comment

by:hexer4u
ID: 35694060
yes, that's the way but it seems your user doesn't have the rights to create a new table.
I suggest adding the following code to you site, anywhere after you are connected to the database and selected it.
$sql = "CREATE TABLE `test`.`url_cache` (
`before` VARCHAR( 255 ) NOT NULL ,
`after` VARCHAR( 140 ) NOT NULL ,
INDEX ( `before` )
) ENGINE = MYISAM ";
mysql_query($sql) or die(mysql_error());

Open in new window

The website's user should have enouth rights to create a table. If not you should ask your ISP to grand you the right to create tables in the database.
0
 
LVL 6

Expert Comment

by:hexer4u
ID: 35694069
Oh, sorry, it seems that I forgot to remove the `test` from the code
Please try again (the way you did before) with
CREATE TABLE `url_cache` (
`before` VARCHAR( 255 ) NOT NULL ,
`after` VARCHAR( 140 ) NOT NULL ,
INDEX ( `before` )
) ENGINE = MYISAM;

Open in new window

0
 

Author Comment

by:badwolfff
ID: 35694158
OUCH!
I get this now when I try to load my site!

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 ''url_cache' WHERE 'before'='' LIMIT 1' at line 1

I added the table using the script you gave me above
my current code looks like this:


 
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.event.plugin');
jimport('joomla.component.application.jview');

//custom URL shortener class
/*class ShortUrl {

	public static function create($url,$provider='tinyurl',$user='',$key='') {
		$api_url = sprintf(self::api($provider),urlencode($url),$user,$key);
		return self::inspect($provider,self::execute($api_url));
	}

	private static function execute($url) {
		$ch = curl_init();
		curl_setopt ($ch, CURLOPT_URL, $url);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
		$text = curl_exec($ch);
		curl_close($ch);
		return $text;
	}

	private static function inspect($provider,$xml) {
		if(!empty($xml)) {
			switch(strtolower(trim($provider))){
				case "bitly":
					$o = new SimpleXMLElement($xml);
					return (string)$o->results->nodeKeyVal->shortUrl;
					break;
				case "trim":
					$o = new SimpleXMLElement($xml);
					return (string)$o->url;
					break;
				case "isgd":
				case "hexio":
				default:
					return $xml;
			}
		}
		return false;
	}

	private static function api($provider) {
		switch(strtolower(trim($provider))){
			case "bitly":
				$return = "http://api.bit.ly/shorten?version=2.0.1&format=xml&longUrl=%s&login=%s&apiKey=%s";
				break;
			case "isgd":
				$return = "http://is.gd/api.php?longurl=%s";
				break;
			case "hexio":
				$return = "http://hex.io/api-create.php?url=%s";
				break;
			case "digg":
				$return = "http://services.digg.com/url/short/create?url=%s&appkey=%s&type=xml";
				break;
			case "trim":
				$return = "http://api.tr.im/v1/trim_url.xml?url=%s";
				break;
			default:
				$return = "http://tinyurl.com/api-create.php?url=%s";
		}
		return $return;
	}
}*/

$sql = "SELECT * FROM 'url_cache' WHERE 'before'='".mysql_real_escape_string($url)."' LIMIT 1";
$check = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($check)==1){//we found it in cache

	function make_bitly_url($url,$login,$appkey,$format = 'xml',$version = '2.0.1')
	{
	$url = mysql_fetch_assoc($check);
	return $url['after'];
}

	  //create the URL
	  $bitly = 'http://api.bit.ly/shorten?version='.$version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='.$appkey.'&format='.$format;
	  
	  //get the url
	  //could also use cURL here
	  $response = file_get_contents($bitly);
	  
	  //parse depending on desired format
	  if(strtolower($format) == 'json')
	  {
		$json = @json_decode($response,true);
$sql = "INSERT INTO 'url_cache' SET 'before'='".mysql_real_escape_string($url)."', 'after'='".mysql_real_escape_string($json['results'][$url]['shortUrl'])."'";
mysql_query($sql) or die(mysql_error());
		return $json['results'][$url]['shortUrl'];
	  }
	  else //xml
	  {
		$xml = simplexml_load_string($response);
$sql = "INSERT INTO 'url_cache' SET 'before'='".mysql_real_escape_string($url)."', 'after'='".mysql_real_escape_string('http://bit.ly/'.$xml->results->nodeKeyVal->hash)."'";
mysql_query($sql) or die(mysql_error());		
		return 'http://bit.ly/'.$xml->results->nodeKeyVal->hash;
	  }
	}
//URL shortener ends here

class plgContentSige extends JPlugin
{
	function plgContentSige(&$subject)
	{
		jimport('joomla.html.parameter');
		parent::__construct($subject);
		$this->_plugin = JPluginHelper::getPlugin('content', 'sige');
		$this->_params = new JParameter($this->_plugin->params);
		if (isset($_SESSION["sigcount"])) 
		{
			unset($_SESSION["sigcount"]);
		}
		if (isset($_SESSION["sigcountarticles"])) 
		{
			unset($_SESSION["sigcountarticles"]);
		}
		// Sprache aus Administrator einlesen
		$this->loadLanguage('plg_content_sige', JPATH_ADMINISTRATOR);
	}
	
	function onContentPrepare($context, &$article, &$params, $limitstart)
	{
		// Wenn Pluginsyntax nicht gefunden, nichts machen
		if (!preg_match("#{gallery}(.*?){/gallery}#s", $article->text)) 
		{
			return;
		}

		$plugin =& JPluginHelper::getPlugin('content', 'sige');
		$pluginParams = new JParameter($plugin->params);

		$mosConfig_absolute_path = JPATH_SITE;
		$mosConfig_live_site = JURI :: base();
		if (substr($mosConfig_live_site, -1) == "/") 
		{
			$mosConfig_live_site = substr($mosConfig_live_site, 0, -1);
		}

		// GD Test - Bugfix "undefined variable" - removed eregi_replace
		if (function_exists("gd_info")) 
		{
			$gdinfo = gd_info();
			$gdsupport = array();
			$version = intval(preg_replace('/[[:alpha:][:space:]()]+/', '', $gdinfo['GD Version']));
			if ($version!=2) $gdsupport[] = '<div class="message">GD Bibliothek nicht vorhanden</div>';
			// PHP Versionsabfrage, um Fehler zu verhindern
			if (substr(phpversion(), 0, 3) < 5.3) 
			{
				if (!$gdinfo['JPG Support']) $gdsupport[] = '<div class="message">GD JPG Bibliothek nicht vorhanden</div>';
			} 
			else 
			{
				if (!$gdinfo['JPEG Support']) $gdsupport[] = '<div class="message">GD JPG Bibliothek nicht vorhanden</div>';
			}
			if (!$gdinfo['GIF Create Support']) $gdsupport[] = '<div class="message">GD GIF Bibliothek nicht vorhanden</div>';
			if (!$gdinfo['PNG Support']) $gdsupport[] = '<div class="message">GD PNG Bibliothek nicht vorhanden</div>';
			if (count($gdsupport)) 
			{
				foreach ($gdsupport as $k=>$v) {echo $v;}
			}
		}
		
		// Joomla Versionsabfrage
		$version = new JVersion();
		if ($version->PRODUCT == "Joomla!" AND $version->RELEASE != "1.6") 
		{
			echo '<div class="message">Joomla 1.6 wird benötigt!</div>';
		}
		
		if (!isset($_SESSION["sigcountarticles"])) 
		{
			$_SESSION["sigcountarticles"] = -1;
		}
		
		// Suche nach Pluginsyntax
		if (preg_match_all("#{gallery}(.*?){/gallery}#s", $article->text, $matches, PREG_PATTERN_ORDER) > 0) 
		{
			$_SESSION["sigcountarticles"]++;			
			if (!isset($_SESSION["sigcount"])) 
			{
				$_SESSION["sigcount"] = -1;
			}
			
			$sige_css = "";
			foreach ($matches[0] as $match) 
			{
				$_SESSION["sigcount"]++;
				$sige_code = preg_replace("/{.+?}/", "", $match);
				// Umwandlung des Strings in einen Array
				$sige_array = explode(",", $sige_code);
				// Bildverzeichnis steht an erster Stelle
				$_images_dir_ = $sige_array[0];

				unset($sige_parameter);
				$sige_parameter = array();
				
				// Existieren Parameter? Ggf. Leerstellen bei Eingabe der Parameter werden entfernt
				if (count($sige_array) >= 2) 
				{
					for ($i=1;$i<count($sige_array);$i++) 
					{
						$parameter_temp = explode("=",$sige_array[$i]);
						if (count($parameter_temp) >= 2) 
						{
							$sige_parameter[strtolower(trim($parameter_temp[0]))] = trim($parameter_temp[1]);
						}
					}
				}

				// Parameter einlesen
				$root = (array_key_exists("root",$sige_parameter)&&$sige_parameter['root']!="")?($sige_parameter['root']):($pluginParams->get('root', 1));				
				
				// Stammordner setzen
				if (!$root) 
				{
					$rootfolder = '/images/';
				} 
				else 
				{
					$rootfolder = '/';
				}

				unset($images);
				$noimage = 0;
				
				// Bilder einlesen
				if ($dh = @opendir($mosConfig_absolute_path.$rootfolder.$_images_dir_)) 
				{
					while (($f = readdir($dh)) !== false) 
					{
						if ((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) 
						{
							$images[] = array('filename' => $f);
							$noimage++;
						}
					}
					closedir($dh);
				}
				
				// Bilderausgabe, falls im angegeben Ordner vorhanden, sonst Anzeige einer Fehlermeldung
				if ($noimage) 
				{
					// Parameter durch Syntax / Einstellungen setzen
					$_width_ 	= (array_key_exists("width",$sige_parameter)&&$sige_parameter['width']!="")?($sige_parameter['width']):($pluginParams->get('th_width', 200));
					$_height_ 	= (array_key_exists("height",$sige_parameter)&&$sige_parameter['height']!="")?($sige_parameter['height']):($pluginParams->get('th_height', 200));
					$ratio		= (array_key_exists("ratio",$sige_parameter)&&$sige_parameter['ratio']!="")?($sige_parameter['ratio']):($pluginParams->get('ratio', 1));
					$gap_v		= (array_key_exists("gap_v",$sige_parameter)&&$sige_parameter['gap_v']!="")?($sige_parameter['gap_v']):($pluginParams->get('gap_v', 30));
					$gap_h		= (array_key_exists("gap_h",$sige_parameter)&&$sige_parameter['gap_h']!="")?($sige_parameter['gap_h']):($pluginParams->get('gap_h', 20));
					$_quality_ 	= (array_key_exists("quality",$sige_parameter)&&$sige_parameter['quality']!="")?($sige_parameter['quality']):($pluginParams->get('th_quality', 80));
					$_quality_png	= (array_key_exists("quality_png",$sige_parameter)&&$sige_parameter['quality_png']!="")?($sige_parameter['quality_png']):($pluginParams->get('th_quality_png', 6));
					$displaynavtip 	= (array_key_exists("displaynavtip",$sige_parameter)&&$sige_parameter['displaynavtip']!="")?($sige_parameter['displaynavtip']):($pluginParams->get('displaynavtip', 1));
					$navtip 		= $pluginParams->get('navtip');
					$displaymessage = (array_key_exists("displayarticle",$sige_parameter)&&$sige_parameter['displayarticle']!="")?($sige_parameter['displayarticle']):($pluginParams->get('displaymessage', 1));
					$message 	= $pluginParams->get('message');
					$thumbs		= (array_key_exists("thumbs",$sige_parameter)&&$sige_parameter['thumbs']!="")?($sige_parameter['thumbs']):($pluginParams->get('thumbs', 1));
					$thumbs_new	= $pluginParams->get('thumbs_new', 1);
					$view		= $pluginParams->get('view', 0);					
					$limit		= (array_key_exists("limit",$sige_parameter)&&$sige_parameter['limit']!="")?($sige_parameter['limit']):($pluginParams->get('limit', 0));
					$limit_quantity	= (array_key_exists("limit_quantity",$sige_parameter)&&$sige_parameter['limit_quantity']!="")?($sige_parameter['limit_quantity']):($pluginParams->get('limit_quantity', 10));
					$noslim	= (array_key_exists("noslim",$sige_parameter)&&$sige_parameter['noslim']!="")?($sige_parameter['noslim']):($pluginParams->get('noslim', 0));
					$caption = (array_key_exists("caption",$sige_parameter)&&$sige_parameter['caption']!="")?($sige_parameter['caption']):($pluginParams->get('caption', 0));
					// IPTC Daten der Bilder einlesen
					$iptc = (array_key_exists("iptc",$sige_parameter)&&$sige_parameter['iptc']!="")?($sige_parameter['iptc']):($pluginParams->get('iptc', 0));
					// IPTC UTF8-kodiert
					$iptcutf8 = (array_key_exists("iptcutf8",$sige_parameter)&&$sige_parameter['iptcutf8']!="")?($sige_parameter['iptcutf8']):($pluginParams->get('iptcutf8', 0));
					// Druckbutton einblenden
					$print = (array_key_exists("print",$sige_parameter)&&$sige_parameter['print']!="")?($sige_parameter['print']):($pluginParams->get('print', 0));
					// Einzelbild ausrichten
					$salign	= (array_key_exists("salign",$sige_parameter)&&$sige_parameter['salign']!="")?($sige_parameter['salign']):($pluginParams->get('salign', 0));
					// Einzelbilder in Galerie verbinden
					$connect	= (array_key_exists("connect",$sige_parameter)&&$sige_parameter['connect']!="")?($sige_parameter['connect']):($pluginParams->get('connect', 0));
					// Downloadbutton einblenden
					$download = (array_key_exists("download",$sige_parameter)&&$sige_parameter['download']!="")?($sige_parameter['download']):($pluginParams->get('download', 0));
					// Bilder als Liste anzeigen
					$list	= (array_key_exists("list",$sige_parameter)&&$sige_parameter['list']!="")?($sige_parameter['list']):($pluginParams->get('list', 0));
					// Crop - Ausschnitt
					$crop	= (array_key_exists("crop",$sige_parameter)&&$sige_parameter['crop']!="")?($sige_parameter['crop']):($pluginParams->get('crop', 0));
					$crop_factor	= (array_key_exists("crop_factor",$sige_parameter)&&$sige_parameter['crop_factor']!="")?($sige_parameter['crop_factor']):($pluginParams->get('crop_factor', 0));
					$random = (array_key_exists("random",$sige_parameter)&&$sige_parameter['random']!="")?($sige_parameter['random']):($pluginParams->get('random', 2));
					$single	= (array_key_exists("single",$sige_parameter)&&$sige_parameter['single']!="")?($sige_parameter['single']):($pluginParams->get('single', 0));	
					// Thumbnaildetail
					$thumbdetail	= (array_key_exists("thumbdetail",$sige_parameter)&&$sige_parameter['thumbdetail']!="")?($sige_parameter['thumbdetail']):($pluginParams->get('thumbdetail', 0));
					// Wasserzeichen
					$watermark	= (array_key_exists("watermark",$sige_parameter)&&$sige_parameter['watermark']!="")?($sige_parameter['watermark']):($pluginParams->get('watermark', 0));
					// Wasserzeichenausrichtung
					$watermarkposition	= (array_key_exists("watermarkposition",$sige_parameter)&&$sige_parameter['watermarkposition']!="")?($sige_parameter['watermarkposition']):($pluginParams->get('watermarkposition', 0));
					// Wassereichenbilder überschreiben
					$watermark_new	= $pluginParams->get('watermark_new', 1);
					// Wasserzeichentransparent
					$watermark_trans	= (array_key_exists("watermark_trans",$sige_parameter)&&$sige_parameter['watermark_trans']!="")?($sige_parameter['watermark_trans']):($pluginParams->get('watermark_trans', 50));
					// Verschlüsselungsmethode
					$encrypt	= (array_key_exists("encrypt",$sige_parameter)&&$sige_parameter['encrypt']!="")?($sige_parameter['encrypt']):($pluginParams->get('encrypt', 1));
					$image_info	= (array_key_exists("image_info",$sige_parameter)&&$sige_parameter['image_info']!="")?($sige_parameter['image_info']):($pluginParams->get('image_info', 1));
					$image_link	= (array_key_exists("image_link",$sige_parameter)&&$sige_parameter['image_link']!="")?($sige_parameter['image_link']):($pluginParams->get('image_link', 0));
					$image_link_new	= (array_key_exists("image_link_new",$sige_parameter)&&$sige_parameter['image_link_new']!="")?($sige_parameter['image_link_new']):($pluginParams->get('image_link', 1));
					$single_gallery	= (array_key_exists("single_gallery",$sige_parameter)&&$sige_parameter['single_gallery']!="")?($sige_parameter['single_gallery']):'';
					$column_quantity = (array_key_exists("column_quantity",$sige_parameter)&&$sige_parameter['column_quantity']!="")?($sige_parameter['column_quantity']):($pluginParams->get('column_quantity', 0));
					$css_image = (array_key_exists("css_image",$sige_parameter)&&$sige_parameter['css_image']!="")?($sige_parameter['css_image']):($pluginParams->get('css_image', 1));
					$css_image_half = (array_key_exists("css_image_half",$sige_parameter)&&$sige_parameter['css_image_half']!="")?($sige_parameter['css_image_half']):($pluginParams->get('css_image_half', 1));
					$copyright = (array_key_exists("copyright",$sige_parameter)&&$sige_parameter['copyright']!="")?($sige_parameter['copyright']):($pluginParams->get('copyright', 1));

					// $sigcount manuell setzen - Aufruf mit count=ZAHL
					if (array_key_exists("count",$sige_parameter)&&$sige_parameter['count'] != "") 
					{ 
						$_SESSION["sigcount"] = $sige_parameter['count']; 
					}

					$jview = JRequest::getWord('view');
					if ($jview != 'featured' AND isset($article->title))
					{
						$itemtitle = preg_replace("/\"/", "'", $article->title);
					}

					// CSS Anweisung für jede einzelne Galerie -- Einzelbilder ausrichten
					if ($salign) 
					{
						if ($salign == 'left') 
						{
							$sige_css .= ".sige_cont_".$_SESSION["sigcount"]." {width:".($_width_+$gap_h)."px;height:".($_height_+$gap_v)."px;float:left;}\n";
						} 
						elseif ($salign == 'right') 
						{
							$sige_css .= ".sige_cont_".$_SESSION["sigcount"]." {width:".($_width_+$gap_h)."px;height:".($_height_+$gap_v)."px;float:right;}\n";
						}
					}
					else 
					{
						$sige_css .= ".sige_cont_".$_SESSION["sigcount"]." {width:".($_width_+$gap_h)."px;height:".($_height_+$gap_v)."px;float:left;}\n";
					}
					
					// Sortierung der Bilder - zufällig, auf- oder absteigend
					if ($random == 1) 
					{
						shuffle($images);
					} 
					elseif ($random == 2) 
					{
						sort($images);
					} 
					elseif ($random == 3) 
					{
						rsort($images);
					} 
					elseif ($random == 4 OR $random == 5) 
					{ // Sortierung nach Änderungsdatum
						for ($a = 0; $a<count($images); $a++) 
						{
							$images[$a]['timestamp'] = filemtime($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
						}
						if ($random == 4) 
						{
							usort($images, array($this,'timeasc'));
						} 
						elseif ($random == 5) 
						{
							usort($images, array($this,'timedesc'));
						}
					}

					// Einzelbild gewählt -> Prüfen, ob es vorhanden ist. Wenn ja, Array und Zählvariable neu setzen!
					// Einzebild mit Galerie
					if ($single) 
					{
						$single_yes = false;
						$count = count($images);

						if ($images[0]['filename'] == $single) 
						{
							if ($single_gallery)
							{
								$noimage_rest = $noimage;
								$limit_quantity = 1;
							}
							$noimage = 1;
							$single_yes = true;
						}
						else
						{
							for ($a = 1; $a < $noimage; $a++) 
							{
								if ($images[$a]['filename'] == $single) 
								{
									if ($single_gallery)
									{
										$noimage_rest = $noimage;
										$limit_quantity = 1;
									}
									$noimage = 1;
									$images[$count] = $images[0];
									$images[0] = array('filename' => $single);
									unset($images[$a]);
									$images[$a] = $images[$count];
									unset($images[$count]);
									$single_yes = true;
								}
							}
						}					
					}

					// Start der Ausgabe
					$html = '';

					// CSS einbinden abhängig, ob Einzelbild gewählt wurde
					if ($single AND $single_yes) 
					{
						$html .= '<span class="sige_single">';
					} 
					else
					{
						$html .= '<span class="sige">';
					}
					
					// Liste gesetzt
					if ($list)
					{
						$html .= '<ul>'; 
					}
					
					// Wasserzeichen
					if ($watermark) 
					{
						for ($a = 0;$a<$noimage;$a++) 
						{
							if ($images[$a]['filename'] != '') 
							{
								// Thumbnailordner wird erstellt, falls noch nicht vorhanden
								if (!is_dir($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm')) 
								{
									mkdir($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm', 0755);
								}
								// Bildname, Endung, Verschlüsselungsmethode
								$imagename = substr($images[$a]['filename'], 0, -4);
								$type = substr(strtolower($images[$a]['filename']),-3);
								$image_hash = $this->encrypt($encrypt,$imagename).'.'.$type;

								$filenamewm = $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash;
								if (!file_exists($filenamewm) OR ($watermark_new != 0)) 
								{
									$watermarkimage = imagecreatefrompng($mosConfig_absolute_path.'/plugins/content/sige/plugin_sige/watermark.png');
									list($width_wm, $height_wm) = getimagesize($mosConfig_absolute_path.'/plugins/content/sige/plugin_sige/watermark.png');
									$imagedata = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);

									// Wasserzeichen je nach Bildtyp erstellen
									if (substr(strtolower($images[$a]['filename']),-3) == 'gif') 
									{
										$origimage = ImageCreateFromGIF($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										if ($watermarkposition == 1) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 2) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 3) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 4) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										else 
										{
											imagecopymerge( $origimage, $watermarkimage, ($imagedata[0] - $width_wm)/2, ($imagedata[1] - $height_wm)/2, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										}
										ImageGIF($origimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash);
									} 
									elseif (substr(strtolower($images[$a]['filename']),-3) == 'jpg') 
									{
										$origimage = ImageCreateFromJPEG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										if ($watermarkposition == 1) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 2) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 3) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 4) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										else 
										{
											imagecopymerge( $origimage, $watermarkimage, ($imagedata[0] - $width_wm)/2, ($imagedata[1] - $height_wm)/2, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										}
										ImageJPEG($origimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash , $_quality_);
									} 
									elseif (substr(strtolower($images[$a]['filename']),-3) == 'png') 
									{
										$origimage = ImageCreateFromPNG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										if ($watermarkposition == 1) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 2) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, 0, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 3) 
										{
											imagecopymerge( $origimage, $watermarkimage, 0, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										elseif ($watermarkposition == 4) 
										{
											imagecopymerge( $origimage, $watermarkimage, $imagedata[0] - $width_wm, $imagedata[1] - $height_wm, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										} 
										else 
										{
											imagecopymerge( $origimage, $watermarkimage, ($imagedata[0] - $width_wm)/2, ($imagedata[1] - $height_wm)/2, 0, 0, $width_wm, $height_wm, 100 - $watermark_trans );
										}
										ImagePNG($origimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash , $_quality_png);
									}
								}
							}
						}
					}
					
					// Vorschaubilderspeicherung gewählt
					if (($thumbs) AND (!$list)) 
					{
						// Thumbnailordner wird erstellt, falls noch nicht vorhanden
						if ((!is_dir($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs')) AND ($thumbs == 1)) 
						{
							mkdir($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs', 0755);
						}
						// Bildschleife - alle Bilder abarbeiten
						for ($a = 0; $a<$noimage; $a++) 
						{
							if ($images[$a]['filename'] != '') 
							{

							// Dateityp im Bildnamen entfernen
							$imagename = substr($images[$a]['filename'], 0, -4);
							$type = substr(strtolower($images[$a]['filename']),-3);
							$image_hash = $this->encrypt($encrypt,$imagename).'.'.$type;
							
								if ($watermark) 
								{
									$filenamethumb = $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$image_hash;
								} 
								else 
								{
									$filenamethumb = $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$images[$a]['filename'];
								}
								
								// Größe der Thumbnails festlegen
								$new_w = $_width_;
								// Berechnung der Proportionen des Bildes - oder gleich wie die Eingabe
								if ($ratio) 
								{
									$imagedata = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);

									$new_h = (int)($imagedata[1]*($new_w/$imagedata[0]));
									if (($_height_) AND ($new_h > $_height_)) 
									{
										$new_h = $_height_;
										$new_w = (int)($imagedata[0]*($new_h/$imagedata[1]));
									}
								} 
								else 
								{ 
									// Proportionen nicht beibehalten, Größe überschreiben
									$new_h = $_height_;
								}
								
								// Abfrage, ob ein neues Thumbnail generiert werden soll
								if ((!file_exists($filenamethumb)) OR ($thumbs_new != 0)) 
								{
									if ($watermark) 
									{
										list($width_ori, $height_ori) = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash);
									} 
									else 
									{
										list($width_ori, $height_ori) = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
									}

									// Crop - Ausschnitt des Bildes anzeigen
									if ($crop AND ((0 < $crop_factor) AND ($crop_factor < 100))) 
									{
										// Größere Seite auswählen - für quadratische Thumbnails
										if ($width_ori > $height_ori) 
										{
											$biggest_side = $width_ori;
										} 
										else 
										{
											$biggest_side = $height_ori;
										}
										// Cropfaktor setzen
										$crop_percent = (1 - ($crop_factor / 100));

										if (!$ratio AND ($_width_ == $_height_)) 
										{ 
											// Keine Seitenverhältnisse und quadratisch
											$crop_width   = $biggest_side * $crop_percent;
											$crop_height  = $biggest_side * $crop_percent;
										} 
										elseif (!$ratio AND ($_width_ != $_height_)) 
										{ 
											// Keine Seitenverhältnisse und rechteckig
											if (($width_ori / $_width_) < ($height_ori / $_height_)) 
											{
												$crop_width   = $width_ori * $crop_percent;
												$crop_height  = ($_height_ * ($width_ori / $_width_)) * $crop_percent;
											} 
											else 
											{
												$crop_width   = ($_width_ * ($height_ori / $_height_)) * $crop_percent;
												$crop_height  =  $height_ori * $crop_percent;
											}
										} 
										else 
										{ 
											// Seitenverhältnisse beibehalten
											$crop_width   = $width_ori * $crop_percent;
											$crop_height  = $height_ori * $crop_percent;
										}
										$x_coordinate = ($width_ori - $crop_width)/2;
										$y_coordinate = ($height_ori - $crop_height)/2;
									}
									
									// Thumbnails je nach Bildtyp erstellen
									if (substr(strtolower($filenamethumb),-3) == 'gif') 
									{
										if ($watermark) 
										{
											$origimage = ImageCreateFromGIF($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash);
										} 
										else 
										{
											$origimage = ImageCreateFromGIF($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										}
										$thumbimage = ImageCreateTrueColor($new_w, $new_h);
										if ($crop AND ((0 < $crop_factor) AND ($crop_factor < 100))) 
										{
											imagecopyresampled($thumbimage, $origimage, 0, 0, $x_coordinate, $y_coordinate, $new_w, $new_h, $crop_width, $crop_height);
										} 
										else 
										{
											if ($thumbdetail == 1) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 2) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 3) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 4) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											else 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $width_ori, $height_ori);
											}
										}
										if ($watermark) 
										{
											ImageGIF($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$image_hash);
										} 
										else 
										{
											ImageGIF($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$images[$a]['filename']);
										}
									} 
									elseif (substr(strtolower($filenamethumb),-3) == 'jpg') 
									{
										if ($watermark) 
										{
											$origimage = ImageCreateFromJPEG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash);
										} 
										else 
										{
											$origimage = ImageCreateFromJPEG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										}
										$thumbimage = ImageCreateTrueColor($new_w, $new_h);
										if ($crop AND ((0 < $crop_factor) AND ($crop_factor < 100))) 
										{
											imagecopyresampled($thumbimage, $origimage, 0, 0, $x_coordinate, $y_coordinate, $new_w, $new_h, $crop_width, $crop_height);
										} 
										else 
										{
											if ($thumbdetail == 1) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 2) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 3) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 4) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											else 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $width_ori, $height_ori);
											}
										}
										if ($watermark) 
										{
											ImageJPEG($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$image_hash , $_quality_);
										} 
										else 
										{
											ImageJPEG($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$images[$a]['filename'] , $_quality_);
										}
									} 
									elseif (substr(strtolower($filenamethumb),-3) == 'png') 
									{

										if ($watermark) 
										{
											$origimage = ImageCreateFromPNG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/wm/'.$image_hash);
										} 
										else 
										{
											$origimage = ImageCreateFromPNG($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
										}
										$thumbimage = ImageCreateTrueColor($new_w, $new_h);
										if ($crop AND ((0 < $crop_factor) AND ($crop_factor < 100))) 
										{
											imagecopyresampled($thumbimage, $origimage, 0, 0, $x_coordinate, $y_coordinate, $new_w, $new_h, $crop_width, $crop_height);
										} 
										else 
										{
											if ($thumbdetail == 1) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 2) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, 0, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 3) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											elseif ($thumbdetail == 4) 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, $width_ori - $new_w, $height_ori - $new_h, $new_w, $new_h, $new_w, $new_h);
											} 
											else 
											{
												imagecopyresampled($thumbimage, $origimage, 0, 0, 0, 0, $new_w, $new_h, $width_ori, $height_ori);
											}
										}
										if ($watermark) 
										{
											ImagePNG($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$image_hash, $_quality_png);
										} 
										else 
										{
											ImagePNG($thumbimage, $mosConfig_absolute_path.$rootfolder.$_images_dir_.'/thumbs/'.$images[$a]['filename'], $_quality_png);
										}
									}
								}
							}
						}
					}

					// Begrenzung der Bilder nicht größer als Anzahl vorhandener Bilder
					if ($limit AND (!$single OR !$single_gallery)) 
					{
						$noimage_rest = $noimage;
						if ($noimage > $limit_quantity) 
						{
							$noimage = $limit_quantity;
						}
					}
					
					// Schleife zum Anzeigen der Bilder - alle Bilder abarbeiten
					for ($a = 0; $a<$noimage; $a++) 
					{
						if ($images[$a]['filename'] != '') 
						{
							// Dateityp im Bildnamen entfernen
							$imagename = substr($images[$a]['filename'], 0, -4);
							$type = substr(strtolower($images[$a]['filename']),-3);
							$image_hash = $this->encrypt($encrypt,$imagename).'.'.$type;
							
							// Liste gesetzt
							if ($list) 
							{
								$html .= '<li>';
							}
							else 
							{
								$html .= '<span class="sige_cont_'.$_SESSION["sigcount"].'"><span class="sige_thumb">';
							}
							// Titel und Überschrift - IPTC aus Bild auslesen
							if ($iptc == 1) 
							{
								list($title_iptc, $caption_iptc) = $this->iptcinfo($a, $rootfolder, $_images_dir_, $images, $iptcutf8);
							}
							
							// Link zu einer URL
							if ($image_link)
							{
								$html .= '<a href="http://'.$image_link.'" title="'.$image_link.'" ';
								if ($image_link_new)
								{
									$html .= 'target="_blank"';
								}
								$html .= '>';
							}
							// CSS Image Tooltip
							elseif ($noslim AND $css_image)
							{
								$html .= '<a class="sige_css_image" href="#sige_thumbnail">';
							}
							// Slimbox-Effekt / Verlinkung
							elseif (!$noslim) 
							{
								if ($watermark) 
								{
										$html .= '<a href="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash.'"';
								} 
								else 
								{
										$html .= '<a href="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/'.$images[$a]['filename'].'"';
								}
								// CSS Image Tooltip
								if ($css_image)
								{
									$html .= ' class="sige_css_image"';
								}

								// Prüfen, ob Verbindung der Bilder gewählt wurde und Ansicht wählen
								if ($connect) 
								{
									if ($view == 0) {$html .= ' rel="lightbox.sig'.$connect.'"';}
									elseif ($view == 1) {$html .= ' rel="lytebox.sig'.$connect.'"';}
									elseif ($view == 2) {$html .= ' rel="lyteshow.sig'.$connect.'"';}
									else {$html .= ' rel="shadowbox[.sig'.$connect.']"';}
								} 
								else 
								{
									if ($view == 0) {$html .= ' rel="lightbox.sig'.$_SESSION["sigcount"].'"';}
									elseif ($view == 1) {$html .= ' rel="lytebox.sig'.$_SESSION["sigcount"].'"';}
									elseif ($view == 2) {$html .= ' rel="lyteshow.sig'.$_SESSION["sigcount"].'"';}
									else {$html .= ' rel="shadowbox[sig'.$_SESSION["sigcount"].']"';}
								}
								// Title-Tag - Anzeige in JS-Galerie
								$html .= ' title="';
								// Navigationstipp anzeigen
								if ($displaynavtip AND ($navtip != '')) 
								{
									$html .= $navtip.'&lt;br /&gt;';
								}
								if ($displaymessage AND $jview != 'featured' AND isset($itemtitle)) 
								{
									if ($message != '') 
									{
										$html .= $message.': ';
									}
									$html .= '&lt;em&gt;'.$itemtitle.'&lt;/em&gt;&lt;br /&gt;';
								} 
								if ($image_info) 
								{
									//Title-Tag aus Bildnamen oder IPTC Werten
									if ($iptc == 0) 
									{
										$html .= ''.$imagename.'';
									} 
									else 
									{
										$html .= ''.$title_iptc.''.$caption_iptc;
									}
								}
								// Druckoption aktiviert - 1.5-10 -- Druckbutton eingefügt
								if (($print == 1) AND ($iptc == 1)) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash).'&amp;name='.rawurlencode($title_iptc).'&amp;caption='.rawurlencode($caption_iptc).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/Midsize/'.$images[$a]['filename']).'&amp;name='.rawurlencode($title_iptc).'&amp;caption='.rawurlencode($caption_iptc).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									}
								} 
								elseif ($print == 1) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash).'&amp;name='.rawurlencode($imagename).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
//										$s = new ShortURL;
//										$s->setUrl($mosConfig_live_site."/plugins/content/sige/plugin_sige/socialshare.php?img=".$mosConfig_live_site.$rootfolder.$_images_dir_."/Midsize/".$images[$a]['filename']."&name=".$imagename);
//										$u = $s->getUrl();
										//
										//echo
										//'Click Here: <a target="_blank" href="'
										//. $u
										//. '">'
										//. $u
										//. '</a>'
										//. PHP_EOL
										//;		
//$url = ($mosConfig_live_site."/plugins/content/sige/plugin_sige/socialshare.php?img=".$mosConfig_live_site.$rootfolder.$_images_dir_."/Midsize/".$images[$a]['filename']."&name=".$imagename);
//$u = make_bitly_url($url,'badwolfff','R_f650e553b78bb0569fc67dbc16a5de7c','json');									

										//send to print, add to facebook, add to twitter, send via email
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/Midsize/'.$images[$a]['filename']).'&amp;name='.rawurlencode($imagename).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									}
								}
								// Download 1.5.11
								if ($download == 1) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.php?img='.rawurlencode($rootfolder.$_images_dir_.'/wm/'.$image_hash).'&quot;  title=&quot;scarica l\'immagine ad alta definizione&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.php?img='.rawurlencode($rootfolder.$_images_dir_.'/'.$images[$a]['filename']).'&quot;  title=&quot;scarica l\'immagine ad alta definizione&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.png&quot; /&gt;&lt;/a&gt;';
									}
								}
								
								//Facebook like button
								/*$facebookhref = $mosConfig_live_site.$rootfolder.$_images_dir_.'/'.$images[$a]['filename'];
								$html .= ' &lt;iframe src=&quot;http://www.facebook.com/plugins/like.php?href='.$facebookhref.'&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;font&amp;colorscheme=light&amp;height=21&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; overflow:hidden; width:100px; height:21px;&quot; allowTransparency=&quot;true&quot;&gt;&lt;/iframe&gt;';*/

//generate shortened URL on the fly using bit.ly interface
$url = $mosConfig_live_site."/plugins/content/sige/plugin_sige/socialshare.php?img=".$mosConfig_live_site.$rootfolder.$_images_dir_."/Midsize/".$images[$a]['filename']."&name=".$imagename;
$u = make_bitly_url($url,'badwolfff','R_f650e553b78bb0569fc67dbc16a5de7c','json');
//$u = file_get_contents('http://www.absolutproject.com/shorten.php?longurl=' . urlencode($url . $_SERVER['HTTP_HOST']  . '/' . $_SERVER['REQUEST_URI']));


								$html .= '&lt;a href=&quot;http://www.facebook.com/sharer.php?u='.$u.'&t=Zuenelli - '.$imagename.'&quot;  title=&quot;aggiungi a facebook&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/facebook.png&quot; /&gt;&lt;/a&gt;
												   &lt;a href=&quot;http://twitter.com/?status=Zuenelli propone - '.$imagename.' (cliccare sul seguente link per scoprire): '.$u.'&quot;  title=&quot;pubblica su twitter&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/twitter.png&quot; /&gt;&lt;/a&gt;
												   &lt;a href=&quot;mailto:?subject=Zuenelli%20propone - '.$imagename.'&body=Cliccare sul link seguente per approfondire o copiare ed incollare lo stesso in un browser - '.$u.'&quot;  title=&quot;invia link via email&quot; target=&quot;_new&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/email.png&quot; /&gt;&lt;/a&gt;';
								
								$html .= '" >';
							}
							// Bilder anzeigen, wenn Liste nicht gewählt
							if (!$list) 
							{
								// Größe der Thumbnails festlegen
								$new_w = $_width_;
								// Berechnung der Proportionen des Bildes - oder gleich wie die Eingabe
								if ($ratio) 
								{
									$imagedata = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);

									$new_h = (int)($imagedata[1]*($new_w/$imagedata[0]));
									if (($_height_) AND ($new_h > $_height_)) 
									{
										$new_h = $_height_;
										$new_w = (int)($imagedata[0]*($new_h/$imagedata[1]));
									}
								} 
								else 
								{ 
									// Proportionen nicht beibehalten, Größe überschreiben
									$new_h = $_height_;
								}
							
								// Vorschaubilderspeicherung gewählt
								if ($thumbs) 
								{
									$html .= '<img alt="" title="';
									//Title-Tag aus Bildnamen oder IPTC Werten
									if ($iptc == 0 OR ($title_iptc == '' AND $caption_iptc == '')) 
									{
										$html .= $imagename;
									} 
									else 
									{
										$html .= $title_iptc.' '.$caption_iptc;
									}
									// Vorschaubild anzeigen
									if ($watermark) 
									{
										$html .= '" src="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/thumbs/'.$image_hash.'" width="'.$new_w.'" height="'.$new_h.'" />';
									} 
									else 
									{
										$html .= '" src="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/thumbs/'.$images[$a]['filename'].'" width="'.$new_w.'" height="'.$new_h.'" />';
									}
								} 
								else 
								{
									// On-the-fly Ausgabe
									$html .= '<img alt=""  title="';
									//Title-Tag aus Bildnamen oder IPTC Werten
									if ($iptc == 0 OR ($title_iptc == '' AND $caption_iptc == '')) 
									{
										$html .= $imagename;
									} 
									else 
									{
										$html .= $title_iptc.' '.$caption_iptc;
									}
									// On-the-fly-Bild anzeigen
									if ($watermark) 
									{
										$html .= '" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/showthumb.php?img='.$rootfolder.$_images_dir_.'/wm/'.$image_hash.'&amp;width='.$_width_.'&amp;height='.$_height_.'&amp;quality='.$_quality_.'&amp;ratio='.$ratio.'&amp;crop='.$crop.'&amp;crop_factor='.$crop_factor.'&amp;thumbdetail='.$thumbdetail.'" />';
									} 
									else 
									{
										$html .= '" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/showthumb.php?img='.$rootfolder.$_images_dir_.'/'.$images[$a]['filename'].'&amp;width='.$_width_.'&amp;height='.$_height_.'&amp;quality='.$_quality_.'&amp;ratio='.$ratio.'&amp;crop='.$crop.'&amp;crop_factor='.$crop_factor.'&amp;thumbdetail='.$thumbdetail.'" />';
									}
								}
							} 
							else 
							{
								if ($iptc == 0 OR ($title_iptc == '' AND $caption_iptc == '')) 
								{
									$html .= $imagename;
								} 
								else 
								{
									$html .= $title_iptc.' - '.$caption_iptc;
								}
							}
							
							// CSS Image Tooltip
							if ($css_image AND !$image_link)
							{
								$html .= '<span>';
								if ($watermark) 
								{
									$html .= '<img src="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash.'"';
								} 
								else 
								{
									$html .= '<img src="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/'.$images[$a]['filename'].'"';
								}
								
								if ($css_image_half AND !$list)
								{
									$imagedata = getimagesize($mosConfig_absolute_path.$rootfolder.$_images_dir_.'/'.$images[$a]['filename']);
									$html .= ' width="'.($imagedata[0]/2).'" height="'.($imagedata[1]/2).'"';
								}
								
								if ($iptc == 0 OR ($title_iptc == '' AND $caption_iptc == '')) 
								{
									$html .= ' title="'.$imagename.'"';
								} 
								else 
								{
									$html .= ' title="'.$title_iptc.' - '.$caption_iptc.'"';
								}
								$html .= ' /></span>';
							}
							
							// Verlinkung
							if (!$noslim OR $image_link OR $css_image) 
							{
								$html .= '</a>';
							}
							// Bildunterschrift gesetzt - bei Liste deaktiviert
							if (($caption) AND (!$list)) 
							{
								if ($iptc == 0)	
								{
									$html .= '</span><span class="sige_caption">'.$imagename.'</span></span>';
								} 
								else 
								{
									$html .= '</span><span class="sige_caption">'.$title_iptc.'</span></span>';
								}
							}
							// Liste
							if ($list) 
							{
								$html .= '</li>';
							} 
							elseif (!$caption) 
							{
								$html .= '</span></span>';
							}
						}
						
						// Zeilenumbruch
						if ($column_quantity)
						{
							if (($a + 1) % $column_quantity == 0)
							{
								$html .= '<br class="sige_clr"/>';
							}
						}
					}	// Ende Bildschleife

					// Liste gesetzt
					if ($list) 
					{
						$html .= '</ul>';
					}
					// Clear Both - Umfließen von Elementen beenden
					$html .="\n<span class=\"sige_clr\"></span>\n</span>\n";

					// Limit gesetzt? Dann restliche Bilder einlesen (auch bei Einzelbild mit Galerie)
					if ((($limit AND $limit_quantity < $noimage_rest) OR ($single AND $single_gallery)) AND (!$image_link OR !$css_image))
					{	
						for ($a = $limit_quantity; $a < $noimage_rest; $a++) 
						{
							if ($images[$a]['filename'] != '') 
							{
								// Dateiendung entfernen in Zusatzbildern
								$imagename = substr($images[$a]['filename'], 0, -4);
								$type = substr(strtolower($images[$a]['filename']),-3);
								$image_hash = $this->encrypt($encrypt,$imagename).'.'.$type;
								
								// Titel und Überschrift - IPTC aus Bild auslesen
								if ($iptc == 1) 
								{
									list($title_iptc, $caption_iptc) = $this->iptcinfo($a, $rootfolder, $_images_dir_, $images, $iptcutf8);
								}
								if ($watermark) 
								{
									$html .= '<span style="display: none"><a href="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash.'"';
								} 
								else 
								{
									$html .= '<span style="display: none"><a href="'.$mosConfig_live_site.$rootfolder.$_images_dir_.'/'.$images[$a]['filename'].'"';
								}

								// Prüfen, ob Verbindung der Bilder gewählt wurde und Ansicht wählen
								if ($connect) 
								{
									if ($view == 0) { $html .= ' rel="lightbox.sig'.$connect.'"'; }
									elseif ($view == 1) { $html .= ' rel="lytebox.sig'.$connect.'"'; }
									elseif ($view == 2) { $html .= ' rel="lyteshow.sig'.$connect.'"'; }
									else { $html .= ' rel="shadowbox[sig'.$connect.']"'; }
								} 
								else 
								{
									if ($view == 0) { $html .= ' rel="lightbox.sig'.$_SESSION["sigcount"].'"'; }
									elseif ($view == 1) { $html .= ' rel="lytebox.sig'.$_SESSION["sigcount"].'"'; }
									elseif ($view == 2) { $html .= ' rel="lyteshow.sig'.$_SESSION["sigcount"].'"'; }
									else { $html .= ' rel="shadowbox[sig'.$_SESSION["sigcount"].']"'; }
								}
								$html .= ' title="';
								// Navigationstipp anzeigen
								if ($displaynavtip AND ($navtip != '')) 
								{
									$html .= $navtip.'&lt;br /&gt;';
								}
								if ($displaymessage AND $view != 'featured' AND isset($itemtitle)) 
								{
									if ($message != '') 
									{
										$html .= $message.': ';
									}
									$html .= '&lt;em&gt;'.$itemtitle.'&lt;/em&gt;&lt;br /&gt;';
								} 
								if ($image_info) 
								{
									//Title-Tag aus Bildnamen oder IPTC Werten
									if ($iptc == 0) 
									{
										$html .= ''.$imagename.'';
									} 
									else 
									{
										$html .= ''.$title_iptc.''.$caption_iptc;
									}
								}
								// Druckoption aktiviert - 1.5-10 -- Druckbutton eingefügt
								if (($print == 1) AND ($iptc == 1)) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash).'&amp;name='.rawurlencode($title_iptc).'&amp;caption='.rawurlencode($caption_iptc).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/Midsize/'.$images[$a]['filename']).'&amp;name='.rawurlencode($title_iptc).'&amp;caption='.rawurlencode($caption_iptc).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									}
								} 
								elseif ($print == 1) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/wm/'.$image_hash).'&amp;name='.rawurlencode($imagename).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.php?img='.rawurlencode($mosConfig_live_site.$rootfolder.$_images_dir_.'/Midsize/'.$images[$a]['filename']).'&amp;name='.rawurlencode($imagename).'&quot;  title=&quot;stampa immagine&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/print.png&quot; /&gt;&lt;/a&gt;';
									}
								}
								// Download 1.5.11
								if ($download == 1) 
								{
									if ($watermark) 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.php?img='.rawurlencode($rootfolder.$_images_dir_.'/wm/'.$image_hash).'&quot;  title=&quot;scarica l\'immagine ad alta definizione&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.png&quot; /&gt;&lt;/a&gt;';
									} 
									else 
									{
										$html .= ' &lt;a href=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.php?img='.rawurlencode($rootfolder.$_images_dir_.'/'.$images[$a]['filename']).'&quot;  title=&quot;scarica l\'immagine ad alta definizione&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/download.png&quot; /&gt;&lt;/a&gt;';
									}
								}
								$html .= '"></a></span>';
							}
						}
					}
					// Copyright anzeigen - 1.5-14
					if ($copyright AND !$single AND !$list)
					{
						$html .= '';
					}
				}
				else
				{
					$html = ''.JText::_('NOIMAGES').'<br /><br />'.JText::_('NOIMAGESDEBUG').' '.$mosConfig_live_site.$rootfolder.$_images_dir_;
				}
				// Ausgabe der Galerie
				$article->text = preg_replace("#{gallery}".$sige_code."{/gallery}#s", $html , $article->text);
			} // Ende - {gallery}
			
			// CSS und JS-Dateien in den Head-Bereich schreiben -- Shadowbox
			$js			= $pluginParams->get('js', 0);
			$lang = JFactory::getLanguage();
			$lang->getTag();
			
			$head = array();
			$head[] = "<style type='text/css'>\n".$sige_css."</style>";
			// JS nur einmal einlesen - beim ersten Artikel
			if ($_SESSION["sigcountarticles"] == 0)
			{
				$head[] = '<link rel="stylesheet" href="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/sige.css" type="text/css" media="screen" />';
				if ($js == 0) 
				{
					if ($lang->getTag() == "de-DE")
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/slimbox.js"></script>';
					}
					else
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/slimbox_en.js"></script>';
					}
					$head[] = '<link rel="stylesheet" href="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/slimbox.css" type="text/css" media="screen" />';
				}
				if ($js == 1) 
				{
					if ($lang->getTag() == "de-DE")
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/lytebox.js"></script>';
					}
					else
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/lytebox_en.js"></script>';
					}
					$head[] = '<link rel="stylesheet" href="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/lytebox.css" type="text/css" media="screen" />';
				}
				if ($js == 2) 
				{
					if ($lang->getTag() == "de-DE")
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/shadowbox.js"></script>';
					}
					else
					{
						$head[] = '<script type="text/javascript" src="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/shadowbox_en.js"></script>';
					}
					$head[] = '<link rel="stylesheet" href="'.$mosConfig_live_site.'/plugins/content/sige/plugin_sige/shadowbox.css" type="text/css" media="screen" />';
					$head[] = '<script type="text/javascript">Shadowbox.init();</script>';
				}
			}
			$head = "\n".implode("\n", $head)."\n";
			$document = &JFactory::getDocument();
			$document->addCustomTag($head);
		} // Ende Pluginsyntax
	} // Ende Funktion onPrepareContent

	// IPTC Funktion - Informationen aus dem Bild
	function iptcinfo($f,$rootfolder,$_images_dir_,$images,$iptcutf8)
	{
		$info = array();
		$data = array();
		// Informationen des Bildes auslesen
		$size = getimagesize(JPATH_SITE.$rootfolder.$_images_dir_.'/'.$images[$f]['filename'], $info);
		// Prüfen, ob IPTC Werte gesetzt sind
		if (isset($info['APP13'])) 
		{
			// IPTC auslesen
			$iptc_php = iptcparse($info['APP13']);
			
			if (is_array($iptc_php))
			{
				if (isset($iptc_php["2#120"][0]))
				{
					$data['caption'] = $iptc_php["2#120"][0];
				}
				else
				{
					$data['caption'] = '';
				}
				
				if (isset($iptc_php["2#005"][0]))
				{
					$data['title'] = $iptc_php["2#005"][0];
				}
				else
				{
					$data['title'] = '';
				}
				
				// IPTC UTF8-kodiert?
				if ($iptcutf8 == 1) 
				{
					$iptctitle = html_entity_decode($data['title'], ENT_NOQUOTES);
					$iptccaption = html_entity_decode($data['caption'], ENT_NOQUOTES);
				} 
				else 
				{
					$iptctitle = utf8_encode(html_entity_decode($data['title'], ENT_NOQUOTES));
					$iptccaption = utf8_encode(html_entity_decode($data['caption'], ENT_NOQUOTES));
				}
			}
			else 
			{
				$iptctitle = '';
				$iptccaption = '';
			}
		}
		else 
		{
			$iptctitle = '';
			$iptccaption = '';
		}
		$ret = array($iptctitle, $iptccaption);
		return ($ret);
	}// Ende Funktion IPTC Daten auslesen

	// Funktionen für Sortierung nach Datum - Änderungsdatum der Bilddateien
	function timeasc($a, $b)
	{
		return strcmp($a["timestamp"], $b["timestamp"]);
	}

	function timedesc($a, $b)
	{
		return strcmp($b["timestamp"], $a["timestamp"]);
	}// Ende Funktionen Sortierung nach Datum
	
	// Verschlüsselungsmethode anwenden
	function encrypt($encrypt,$imagename)
    {
		if ($encrypt == 0) 
		{
			$image_hash = str_rot13($imagename);
		} 
		elseif ($encrypt == 1) 
		{
			$image_hash = md5($imagename);
		} 
		elseif ($encrypt == 2) 
		{
			$image_hash = sha1($imagename);
		}
		return ($image_hash);
    }
} // Ende Klasse plgContentSige

?>

Open in new window


thanks again
0
 

Author Comment

by:badwolfff
ID: 35694219
please help can't get the site up again even after deleting the newly created table url_cache from my mysql database!
what did I do wrong?

thx again
0
 
LVL 6

Expert Comment

by:hexer4u
ID: 35694261
you replaced ` with '
values are wrapped with ', while table columns, tables and databases are wrapped with ` (the key to the left of key with number 1 on it)
Plus, you put part of the code before the function
I fixed it and you can find it attached fixed.php
0
 

Author Comment

by:badwolfff
ID: 35700360
thanks so much!
It works OF COURSE!
By the way hexer4u this is the second time you have helped me out with a php question - thanks again!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question