Help needed for new gallery

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Help needed for new gallery

Post by calguy1000 »

I'm currently working on a simpleviewer gallery (flash) that (hopefully) will be quite nice.

It will tie into the uploads module for uploading images, etc. and (as soon as I put it in) automatic thumbnail generation.  It will support multiple galleries, and different configurations for each.

thinks it will not support:
heirarchical galleries
exit tags (right off the bat), but this can be added at a later date I would think.

any questions, drop me a line.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
fexcel
Forum Members
Forum Members
Posts: 16
Joined: Wed Nov 09, 2005 9:16 pm
Location: Sevilla - Spain

Re: Help needed for new gallery

Post by fexcel »

Hi Patricia,
Today, Samuel Goldstein has released Cataloger.

It looks very nice and i'm sure it will be a good option in the near future.
You can download it from the development zone at: http://dev.cmsmadesimple.org/projects/cataloger
Enjoy testing!.

NOTE: it works fine in Firefox, bus there are some problems with IE.
Last edited by fexcel on Thu Nov 24, 2005 6:47 pm, edited 1 time in total.
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Re: Help needed for new gallery

Post by kishman155 »

Code: Select all

<__script__ language="JavaScript" type="text/javascript">
<!--

function ZeigeBild(bildname)
{
  var ref,parameter,dateiname,htmlcode,b=640,h=480;

  dateiname=bildname.substring(bildname.indexOf("/")+1,bildname.length);

  htmlcode="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
  htmlcode+="<__html style=\"height: 100%\">\n<head>\n<title>"+dateiname+"<\/title>\n";
  htmlcode+="<\/head>\n<body style=\"margin: 0; padding: 0; height: 100%\">\n";
  htmlcode+="<img src=\""+bildname+"\" width=\"100%\" height=\"100%\" alt=\""+bildname+"\" title=\"[Mausklick schließt Fenster!]\" onclick=\"window.close()\">\n<\/body>\n<\/html>\n";

  parameter="width="+b+",height="+h+",screenX="+(screen.width-b)/2+",screenY="+(screen.height-h)/2+",left="+(screen.width-b)/2+",top="+(screen.height-h)/2;

  ref=window.open("","bildfenster",parameter);
  ref.document.open("text/html");
  ref.document.write(htmlcode);
  ref.document.close();
  ref.focus();
}

//-->
</__script>

Code: Select all

<table border="1" width="100%" summary="Informations Images">
<tr>
<th>Filename</th><th>Filesize</th><th>Date/time</th><th>width</th><th>Height</th><th>color</th><th>flash</th><th>Orient.</th><th>thumb</th><th>txt</th>
</tr>
<?php




// PHP-Version
$verstr=explode(".",phpversion());
$vernum=$verstr[0]*100+$verstr[1]*10+$verstr[2]*1;

$bilder_verzeichnis="bilder";//imagefolder
$vorschau_verzeichnis="vorschau";//thumbfolder must be writeable
$txtverzeichnis="imagetxt";// txtfiles for images if you wana store imagescomments in txtfiles

$verz=opendir($bilder_verzeichnis);

while($datei=readdir($verz))
{
  if($datei != "." && $datei != "..")
  {
    $bild=$bilder_verzeichnis."/".$datei;

    if($vernum >= 420)
    {
      // Read exifdata from Image
      $exifdata=exif_read_data($bild,"",true,false);

      if($exifdata["FILE"]["FileName"])$dateiname=$exifdata["FILE"]["FileName"];
      if($exifdata["FILE"]["FileSize"])$dateigroesse=$exifdata["FILE"]["FileSize"];
      if($exifdata["FILE"]["FileDateTime"])$dateidatumzeit=date("d.m.Y – H:i:s",$exifdata["FILE"]["FileDateTime"]);
      if($exifdata["EXIF"]["ExifImageWidth"])$breite=$exifdata["EXIF"]["ExifImageWidth"];
      if($exifdata["EXIF"]["ExifImageLength"])$hoehe=$exifdata["EXIF"]["ExifImageLength"];
      if($exifdata["COMPUTED"]["IsColor"])$farbe=$exifdata["COMPUTED"]["IsColor"]; 
      if($exifdata["EXIF"]["Flash"])$blitz=$exifdata["EXIF"]["Flash"];
      if($exifdata["IFD0"]["Orientation"])$orientierung=$exifdata["IFD0"]["Orientation"];
      if($exifdata["COMMENT"][0])$kommentar=$exifdata["COMMENT"][0];

      if($exifdata["FILE"]["FileDateTime"])$dateidatumzeit="D: ".date("d.m.Y – H:i:s",$exifdata["FILE"]["FileDateTime"]);
      if($exifdata["EXIF"]["DateTimeOriginal"])
      {
        $datumzeit=explode(" ",$exifdata["EXIF"]["DateTimeOriginal"]);
        $aufnamezeit=$datumzeit[1];
        $aufnamedatum=explode(":",$datumzeit[0]);
        $aufnamedatumzeit="A: ".$aufnamedatum[2].".".$aufnamedatum[1].".".$aufnamedatum[0]." – ".$aufnamezeit."<br>";
      }
      else $aufnamedatumzeit="";

      // Vorschaubild holen
      $vorschau=exif_thumbnail($bild);
    }

    if($vernum < 420 && $vernum >= 401)
    {
      $exifdata=read_exif_data($bild);

      // Daten aus den Bildern auslesen
      if($exifdata["FileName"])$dateiname=$exifdata["FileName"];
      if($exifdata["FileSize"])$dateigroesse=$exifdata["FileSize"];
      if($exifdata["FileDateTime"])$dateidatumzeit="D: ".date("d.m.Y – H:i:s",$exifdata["FileDateTime"]);
      if($exifdata["DateTime"])
      {
        $datumzeit=explode(" ",$exifdata["DateTime"]);
        $aufnamezeit=$datumzeit[1];
        $aufnamedatum=explode(":",$datumzeit[0]);
        $aufnamedatumzeit="A: ".$aufnamedatum[2].".".$aufnamedatum[1].".".$aufnamedatum[0]." – ".$aufnamezeit."<br>";
      }
      else $aufnamedatumzeit="";
      if($exifdata["Width"])$breite=$exifdata["Width"];
      if($exifdata["Height"])$hoehe=$exifdata["Height"];
      if($exifdata["IsColor"])$farbe=$exifdata["IsColor"]; 
      if($exifdata["FlashUsed"])$blitz=$exifdata["FlashUsed"];
      if($exifdata["Orientation"])$orientierung=$exifdata["Orientation"];
      if($exifdata["Comments"])$kommentar=$exifdata["Comments"];

      // Vorschaubild holen
      $vorschau=$exifdata["Thumbnail"];
    }

    // Daten ausgeben
    if(!empty($kommentar))print "<tr>\n<td><strong>$dateiname</strong><p>$kommentar</p></td><td>$dateigroesse</td><td>$aufnamedatumzeit"."$dateidatumzeit</td><td>$breite</td><td>$hoehe</td><td>$farbe</td><td>$blitz</td><td>$orientierung</td>\n";
    else print "<tr>\n<td><strong>$dateiname</strong></td><td>$dateigroesse</td><td>$aufnamedatumzeit"."$dateidatumzeit</td><td>$breite</td><td>$hoehe</td><td>$farbe</td><td>$blitz</td><td>$orientierung</td>\n";

    // Show Thumb if exists
    if(!empty($vorschau))
    {
      $vorschau_name=$vorschau_verzeichnis."/".str_replace(".jpg","_v.jpg",strtolower($datei));
      $file=fopen($vorschau_name,"wb");
      fwrite($file,$vorschau);
      fclose($file);

      $parameter=getimagesize($vorschau_name);
      $width_height=$parameter[3];
      print "<td><a href=\"$bild\" target=\"vollbild\" onclick=\"ZeigeBild('$bild');return false\"><img src=\"$vorschau_name\" $width_height title=\"Bild $datei anzeigen\" alt=\"Vorschaubild zu $datei\" border=\"0\"></a></td>\n";
    }
    else 
{
print "<td><a href=\"$bild\" target=\"vollbild\" onclick=\"ZeigeBild('$bild');return false\" title=\"Bild $datei anzeigen\">keine</a></td>\n";
}

/**
// txtfile for Imgae
$txt=file($txtverzeichnis.'/'.$datei.'.txt');
 print "<td>".$txt."</td>"\n;
    print "</tr>\n";
*/
  }
}

?>
<tr>
<td colspan="10">[A: Aufnahme | D: Datei | PHP-Version: <?=phpversion();?>]</td>
</tr>
</table>


i hope it helps it reads many exifdata and show the thumb wich is inside the image

you could add comments to the image using an programm to edit exifdata

what you have to do is to make an module wich make chooseable contenttype for telling
the script in which
folder he should look for the images

here is an example from my bildermodule

Code: Select all

class bilderModule extends CMSModuleContentType
{

  function FillParams(&$params)
  {
    global $gCms;
    $config = $gCms->config;
    if (isset($params))
    {
      $parameters = array('name');
			foreach ($parameters as $oneparam)
			{
				if (isset($params[$oneparam]))
				{
					$this->SetPropertyValue($oneparam, $params[$oneparam]);
				}
			}
      if (isset($params['title']))
			{
				$this->mName = $params['title'];
			}
			if (isset($params['menutext']))
			{
				$this->mMenuText = $params['menutext'];
			}
			if (isset($params['template_id']))
			{
				$this->mTemplateId = $params['template_id'];
			}
			if (isset($params['alias']))
			{
				$this->SetAlias($params['alias']);
			}
			else
			{
				$this->SetAlias('');
			}
			if (isset($params['parent_id']))
			{
				if ($this->mParentId != $params['parent_id'])
				{
					$this->mHierarchy = '';
					$this->mItemOrder = -1;
				}
				$this->mParentId = $params['parent_id'];
			}
			if (isset($params['active']))
			{
				$this->mActive = true;
			}
			else
			{
				$this->mActive = false;
			}
			if (isset($params['showinmenu']))
			{
				$this->mShowInMenu = true;
			}
			else
			{
				$this->mShowInMenu = false;
			}
    }
  }

  function GetURL()
  {
    global $gCms;
    $config = $gCms->config;
    $url = "";
    if ($config["assume_mod_rewrite"])
    {
      $url = $config["root_url"]."/".$this->mId.".shtml";
    }
    else
    {
      $url = $config["root_url"]."/index.php?".$config["query_var"]."=".$this->mId;
    }

    return $url;
  }

  function FriendlyName()
  {
    return 'Bilder';
  }
  	function EditAsArray($adding = false)
	{
		global $gCms;
		$config = $gCms->config;

		$ret = array();

		array_push($ret,array(lang('title').':','<input type="text" name="title" value="'.$this->mName.'">'));
		array_push($ret,array(lang('menutext').':','<input type="text" name="menutext" value="'.$this->mMenuText.'">'));
		#if (!($config['auto_alias_content'] == true && $this->mAlias == ''))
		if (!($config['auto_alias_content'] == true && $adding))
		{
			array_push($ret,array(lang('pagealias').':','<input type="text" name="alias" value="'.$this->mAlias.'">'));
		}
		array_push($ret,array(lang('template').':',TemplateOperations::TemplateDropdown('template_id', $this->mTemplateId)));
		array_push($ret,array($this->Lang('name').':','<input type="text" name="name" value="'.$this->GetPropertyValue('name').'" />'));
		array_push($ret,array(lang('active').':','<input type="checkbox" name="active"'.($this->mActive?' checked="true"':'').'>'));
		array_push($ret,array(lang('showinmenu').':','<input type="checkbox" name="showinmenu"'.($this->mShowInMenu?' checked="true"':'').'>'));
		array_push($ret,array(lang('parent').':',ContentManager::CreateHierarchyDropdown($this->mId, $this->mParentId)));

		return $ret;
	}
	function ModuleName()
	{
		return 'bilder';
	}
  	function Edit($adding = false)
	{
		global $gCms;
		$config = $gCms->config;

		$text = '';

		$text .= '<tr><td>'.lang('title').':</td><td><input type="text" name="title" value="'.$this->mName.'"></td></tr>';
		$text .= '<tr><td>'.lang('menutext').':</td><td><input type="text" name="menutext" value="'.$this->mMenuText.'"></td></tr>';
		#if (!($config['auto_alias_content'] == true && $this->mAlias == ''))
		if (!($config['auto_alias_content'] == true && $adding))
		{
			$text .= '<tr><td>'.lang('pagealias').':</td><td><input type="text" name="alias" value="'.$this->mAlias.'"></td></tr>';
		}
		$text .= '<tr><td>'.lang('template').':</td><td>'.TemplateOperations::TemplateDropdown('template_id', $this->mTemplateId).'</td></tr>';
		$text .= '<tr><td>'.$this->Lang('name').':</td><td><input type="text" name="name" value="'.$this->GetPropertyValue('name').'" /></td></tr>';
		$text .= '<tr><td>'.lang('active').':</td><td><input type="checkbox" name="active"'.($this->mActive?' checked="true"':'').'></td></tr>';
		$text .= '<tr><td>'.lang('showinmenu').':</td><td><input type="checkbox" name="showinmenu"'.($this->mShowInMenu?' checked="true"':'').'></td></tr>';
		$text .= '<tr><td>'.lang('parent').':</td><td>'.ContentManager::CreateHierarchyDropdown($this->mId, $this->mParentId).'</td></tr>';

		return $text;
	}
	function Show()
	{
		global $gCms;

		$params = array();

			$params['name'] = $this->GetPropertyValue('name');

		$bilder = new bilder();

		//Buffer all this crap spit out by the News module and return it
		@ob_start();
		$bilder->DoAction('default', 'bildermodule', $params);
		$text .= @ob_get_contents();
		@ob_end_clean();
		return $text;
	}
	function IsDefaultPossible()
	{
		return TRUE;
	}
	function SetProperties()
	{
		$this->mProperties->Add('string', 'name');

		#Turn on preview
		$this->mPreview = true;

		#Turn off caching
		$this->mCachable = false;
	}
}
mfg
kishman155
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Re: Help needed for new gallery

Post by kishman155 »

There is no need for an admin interface.

I forgot not shown to adminuser.

the only thing you need is to change contenttype to bilder and now you have the options
for the module.

by the way
if you modify bilder and add the the table with the exifdata inside

Code: Select all

 case:"default"
and change the code

Code: Select all

$bilder_verzeichnis="bilder"
into

Code: Select all

$params['name']

the modul is finished

kishman155

mfg
kishman155
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Re: Help needed for new gallery

Post by kishman155 »

replace

Code: Select all

 if(!empty($vorschau))
    {
      $vorschau_name=$vorschau_verzeichnis."/".str_replace(".jpg","_v.jpg",strtolower($datei));
      $file=fopen($vorschau_name,"wb");
      fwrite($file,$vorschau);
      fclose($file);

      $parameter=getimagesize($vorschau_name);
      $width_height=$parameter[3];
      print "<td><a href=\"$bild\" target=\"vollbild\" onclick=\"ZeigeBild('$bild');return false\"><img src=\"$vorschau_name\" $width_height title=\"Bild $datei anzeigen\" alt=\"Vorschaubild zu $datei\" border=\"0\"></a></td>\n";
    }
    else
{
print "<td><a href=\"$bild\" target=\"vollbild\" onclick=\"ZeigeBild('$bild');return false\" title=\"Bild $datei anzeigen\">keine</a></td>\n";
}
with

Code: Select all

 $vorschau_name=$vorschau_verzeichnis."/thumb_".$datei;
print "<td><a href=\"$bild\" target=\"vollbild\" onclick=\"ZeigeBild('$bild');return false\"><img src=\"$vorschau_name\" $width_height title=\"Bild $datei anzeigen\" alt=\"Vorschaubild zu $datei\" border=\"0\"></a></td>\n";
bitte schön
Post Reply

Return to “Modules/Add-Ons”