Seite 1 von 1

smartor album und .gif thumbnails

Verfasst: 03.04.2005 19:57
von Helmut71
Frage an alle:

Wieso wird im smartor-Album eigentlich bei gif Dateien kein Vorschaubildchen angezeigt, sondern nur das lapidare no thumbnail?

Lässt sich dieser Umstand irgendwie beheben oder umgehen??

Verfasst: 03.04.2005 21:05
von Markus67

Verfasst: 03.04.2005 23:46
von Helmut71
ich konnte nur die erste seite des threads sehen, weil smartor down ist, aber der code, der dort ist, scheint bei mir nicht zu funktionieren.

Im Portal & Album wird statt dem Vorschaubild des gifs nur ein Fehler /rotes x Bild) angezeigt.

Hat jemand Erfahrung damit, bzw das schon mal gemacht??

Verwende Album Cat. Hierachy & SP1

Verfasst: 04.04.2005 19:26
von Max
Hi,


eigentlich kann man das auch für den Hierarchy-MOD und SP nutzen, man muss nur die selben Anpassungen auch für die Mid-Thumbnails machen.
So funktioniert es jedenfalls bei mir im Album.



Gruß Max

Verfasst: 04.04.2005 19:44
von Helmut71
hmm ich kann nur sagen, ich habs genau so gemacht wie auf der smartor Seite beschrieben und ich habe neben der album_thumbnail.php auch die album_picm.php so modifiziert.

Das Ergebnis war imme rein Fehlerbildchen mit rotem x.

Verfasst: 04.04.2005 20:03
von Markus67
Hi ...

Ich habe jetzt nicht nachgesehen ob das der gleiche Fix ist ... falls ja schaut mal den ganzen Beitrag durch ... bei mir hat es anschliessend funktioniert .
http://smartor.is-root.com/viewtopic.php?p=24680#24680

Markus

Verfasst: 04.04.2005 21:01
von Helmut71
Könnte mir jemand, am besten jemand der auch die Album CH und SP1 benutzt, bitte seine album_thumbnail und album_picm zur Verfügung stellen??

danke im voraus!

(zB Max)

Verfasst: 05.04.2005 07:30
von Max
Hi,


ja, das würde ich.
Aber ich habe etliche weitere Sachen von Smartors Seite und anderen Seiten verbaut, daher ist nicht sicher, ob das bei Dir funktionieren wird.

Sicherheitshalber hier mal das, worauf meine Änderungen beruhen (habe den Thread-Link oben nicht geklickt)

Code: Alles auswählen

  
# ---[ OPEN ]---------------- 
# 
album_thumbnail.php 

# 
# ---[ FIND ]---------------- 
# 
if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') ) 

# 
# ---[ REPLACE WITH ]---------------- 
# 
if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') and ($pic_filetype != '.gif') ) 

# 
# ---[ FIND ]---------------- 
# 
case '.jpg': 
   header('Content-type: image/jpeg'); 
   break; 

# 
# ---[ BEFORE ADD ]---------------- 
# 
case '.gif': 

# 
# ---[ FIND ]---------------- 
# 
case '.jpg': 
   $read_function = 'imagecreatefromjpeg'; 
   break; 

# 
# ---[ BEFORE ADD ]---------------- 
# 
case '.gif': 
   $read_function = 'imagecreatefromgif'; 
   $pic_filetype = '.jpg'; 
   break; 

# 
# ---[ SAVE ]---------------- 
#
Und das muss in der album_picm auch gemacht werden.


Ansonsten helfe ich auch mit meinen Dateien aus.




Gruß Max

Verfasst: 05.04.2005 11:51
von Helmut71
Ich glaub ich hab die Änderungen jetzt zum 5. Mal gemacht, genauso wie beschrieben.

Teil meiner thumbnail.php

Code: Alles auswählen

// ------------------------------------
// Send Thumbnail to browser
// ------------------------------------

if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') and ($pic_filetype != '.gif') ) 

{
	// --------------------------------
	// GD does not support GIF so we must SEND a premade No-thumbnail pic then EXIT
	// --------------------------------

	header('Content-type: image/jpeg');
	readfile($images['no_thumbnail']);
	exit;
}
else
{
	// --------------------------------
	// Check thumbnail cache. If cache is available we will SEND & EXIT
	// --------------------------------

	if( ($album_config['thumbnail_cache'] == 1) and ($pic_thumbnail != '') and file_exists(ALBUM_CACHE_PATH . $pic_thumbnail) )
	{
		switch ($pic_filetype)
		{
			case '.gif': 
			case '.jpg':
				header('Content-type: image/jpeg');
				break;
			case '.png':
				header('Content-type: image/png');
				break;
		}

		readfile(ALBUM_CACHE_PATH . $pic_thumbnail);
		exit;
	}


	// --------------------------------
	// Hmm, cache is empty. Try to re-generate!
	// --------------------------------

	$pic_size = @getimagesize(ALBUM_UPLOAD_PATH . $pic_filename);
	$pic_width = $pic_size[0];
	$pic_height = $pic_size[1];

	$gd_errored = FALSE;
	switch ($pic_filetype)
	{
		case '.gif': 
			$read_function = 'imagecreatefromgif'; 
			$pic_filetype = '.jpg'; 
			break; 
		case '.jpg':
			$read_function = 'imagecreatefromjpeg';
			break;
		case '.png':
			$read_function = 'imagecreatefrompng';
			break;
	}

	$src = @$read_function(ALBUM_UPLOAD_PATH  . $pic_filename);

	if (!$src)
	{
		$gd_errored = TRUE;
		$pic_thumbnail = '';
	}
	else if( ($pic_width > $album_config['thumbnail_size']) or ($pic_height > $album_config['thumbnail_size']) )
	{
		// ----------------------------
		// Resize it
		// ----------------------------

		if ($pic_width > $pic_height)
		{
			$thumbnail_width = $album_config['thumbnail_size'];
			$thumbnail_height = $album_config['thumbnail_size'] * ($pic_height/$pic_width);
		}
		else
		{
			$thumbnail_height = $album_config['thumbnail_size'];
			$thumbnail_width = $album_config['thumbnail_size'] * ($pic_width/$pic_height);
		}

		$thumbnail = ($album_config['gd_version'] == 1) ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height);

		$resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled';

		@$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height);
	}
	else
	{
		$thumbnail = $src;
	}

	if (!$gd_errored)
	{
		if ($album_config['thumbnail_cache'] == 1)
		{
			// ------------------------
			// Re-generate successfully. Write it to disk!
			// ------------------------

			$pic_thumbnail = $pic_filename;

			switch ($pic_filetype)
			{
				case '.jpg':
					@imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']);
					break;
				case '.png':
					@imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail);
					break;
			}

			@chmod(ALBUM_CACHE_PATH . $pic_thumbnail, 0777);
		}


		// ----------------------------
		// After write to disk, donot forget to send to browser also
		// ----------------------------

		switch ($pic_filetype)
		{
			case '.jpg':
				@imagejpeg($thumbnail, '', $album_config['thumbnail_quality']);
				break;
			case '.png':
				@imagepng($thumbnail);
				break;
		}

		exit;
	}
	else
	{
		// ----------------------------
		// It seems you have not GD installed :(
		// ----------------------------

		header('Content-type: image/jpeg');
		readfile('images/nothumbnail.jpg');
		exit;
	}
}


// +------------------------------------------------------+
// |  Powered by Photo Album 2.x.x (c) 2002-2003 Smartor  |
// +------------------------------------------------------+

?>
und meiner picm.php

Code: Alles auswählen

// ------------------------------------
// Send Thumbnail to browser
// ------------------------------------

if( ($pic_filetype != '.jpg') and ($pic_filetype != '.png') and ($pic_filetype != '.gif') ) 
{
	// --------------------------------
	// GD does not support GIF so we must SEND a premade No-thumbnail pic then EXIT
	// --------------------------------

	header('Content-type: image/jpeg');
	readfile($images['no_thumbnail']);
	exit;
}
else
{
	// --------------------------------
	// Check thumbnail cache. If cache is available we will SEND & EXIT
	// --------------------------------

	if( ($album_sp_config['midthumb_cache'] == 1) and ($pic_thumbnail != '') and file_exists(ALBUM_MED_CACHE_PATH . $pic_thumbnail) )
	{
		switch ($pic_filetype)
		{
			case '.gif': 
			case '.jpg':
				header('Content-type: image/jpeg');
				break;
			case '.png':
				header('Content-type: image/png');
				break;
		}

		readfile(ALBUM_MED_CACHE_PATH . $pic_thumbnail);
		exit;
	}


	// --------------------------------
	// Hmm, cache is empty. Try to re-generate!
	// --------------------------------

	$pic_size = @getimagesize(ALBUM_UPLOAD_PATH . $pic_filename);
	$pic_width = $pic_size[0];
	$pic_height = $pic_size[1];

	$gd_errored = FALSE;
	switch ($pic_filetype)
	{
		case '.gif': 
			$read_function = 'imagecreatefromgif'; 
			$pic_filetype = '.jpg'; 
			break; 
		case '.jpg':
			$read_function = 'imagecreatefromjpeg';
			break;
		case '.png':
			$read_function = 'imagecreatefrompng';
			break;
	}

	$src = @$read_function(ALBUM_UPLOAD_PATH  . $pic_filename);

	if (!$src)
	{
		$gd_errored = TRUE;
		$pic_thumbnail = '';
	}
	else if( ($pic_width > $album_sp_config['midthumb_width']) or ($pic_height > $album_sp_config['midthumb_height']) )
	{
		// ----------------------------
		// Resize it
		// ----------------------------

		if ($pic_width > $pic_height)
		{
			$thumbnail_width = $album_sp_config['midthumb_width'];
			$thumbnail_height = $album_sp_config['midthumb_width'] * ($pic_height/$pic_width);
		}
		else
		{
			$thumbnail_height = $album_sp_config['midthumb_height'];
			$thumbnail_width = $album_sp_config['midthumb_height'] * ($pic_width/$pic_height);
		}
		
		if ($album_config['gd_version'] != 3)
		{
			$thumbnail = ($album_config['gd_version'] == 1) ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height);
			$resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled';
			@$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height);
		}
		else
		{
			copy ( $src, $thumbnail );
        	@chmod ($outthumb, 0666);
        	$syscmd = "'c:\ImageMagick\mogrify.exe' -size $thumbnail_width x $thumbnail_height -quality 70 -geometry $thumbnail_width x $thumbnail_height $thumbnail ";
		}
	}
	else
	{
		$thumbnail = $src;
	}

	if (!$gd_errored)
	{
		if ($album_sp_config['midthumb_cache'] == 1)
		{
			// ------------------------
			// Re-generate successfully. Write it to disk!
			// ------------------------

			$pic_thumbnail = $pic_filename;

			switch ($pic_filetype)
			{
				case '.jpg':
					@imagejpeg($thumbnail, ALBUM_MED_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']);
					break;
				case '.png':
					@imagepng($thumbnail, ALBUM_MED_CACHE_PATH . $pic_thumbnail);
					break;
			}

			@chmod(ALBUM_MED_CACHE_PATH . $pic_thumbnail, 0777);
		}


		// ----------------------------
		// After write to disk, donot forget to send to browser also
		// ----------------------------

		switch ($pic_filetype)
		{
			case '.jpg':
				@imagejpeg($thumbnail, '', $album_config['thumbnail_quality']);
				break;
			case '.png':
				@imagepng($thumbnail);
				break;
		}

		exit;
	}
	else
	{
		// ----------------------------
		// It seems you have not GD installed :(
		// ----------------------------

		header('Content-type: image/jpeg');
		readfile('images/nothumbnail.jpg');
		exit;
	}
}


// +-------------------------------------------------------------+
// |  Powered by Photo Album 2.x.x (c) 2002-2003 Smartor         |
// |  with Volodymyr (CLowN) Skoryk's Service Pack 1 © 2003-2004 |
// +-------------------------------------------------------------+

?>
Ich habs garantiert so gemacht, wie beschrieben. Trotzdem bekomm ich bei der Bildvorschau um Portal, Album nur das "rote x Bilchen" bei einem gif.

Bin schon etwas frustriert...