Location: PHPKode > scripts > Image SQL manager > image-sql-manager/php_imageSQL.class.inc.phps
<?php

if(!isset($modules_imageSQL)) {
	
	$modules_imageSQL = 1;
	
	include("php_SQL.class.inc.php");
	include("php_image.class.inc.php");
	
	// wrapper class
	class ImageSQL extends Image{
		var $sql;
		
		function ImageSQL(&$sql,$id=-1, $debug = false) {
			$this->Image($debug);
			$this->sql =& $sql;
			if($id > -1) {
				$this->id = $id;
				$this->loadFromSQL($this->sql,$this->id);
			}
		}
		
		// inherited function loadFromBinary($string,$nom="image");
		// inherited function saveToSQL($sql)
		
		// wrapper afficherFormatee()
		/*!
			@function   display
			@abstract   (description)
			@discussion (description)
			@param      #param 'f'|'h'|'o' f for HTML <TABLE> formatted display; 'h' for HTML <IMG> target unformatted; 'o' to print directly to standard php out
#options '-desc'||'-stdout' -desc to display description; -stdout to standard output (simili to 'o' function)
		@return  boolean true if succeeded
			*/
		
		function display ($param = 'f',$options="") {
			$_options=array();
			$mode = 0;
			$desc = false;
			// options evals
			if($active = TRUE) 
				$_options["-desc"] = "stristr(\$options,\"-desc\");";
			define("OPTION_DESC",$_options["-desc"]);
			if($active = TRUE)
				$_options["-stdout"] = "stristr(\$options,\"-stdout\");";
			define("OPTION_STDOUT",$_options["-stdout"]);
			// PARAMS
			if($param == 'f') {
				$mode = 0;
				$desc = TRUE;
			} else if ($param == 'h') {
					return $this->afficher(0, $this->id.".".$this->getExtension());
			} else if($param == 'o') {
				return $this->afficher(1);
			}
			// OPTIONS 
			if(eval(OPTION_DESC)) {
				$desc = FALSE;
			}
			else if(eval(OPTION_STDOUT)) {
				$mode = 1;
			}
			else { // param inconnu E_ERROR thrown
				trigger_error("ImageSQL::display($param,$options) Unknown options!", E_ERROR);
			}
			return $this->afficherCadre($mode,$desc);
		}
		
	}
	
}
		?>
Return current item: Image SQL manager