Album Hot Or Not Mid-Thumbnail benutzen
Verfasst: 17.05.2007 11:33
Hallo, wie kann ich bei der hot or not die Funktion Mid-Thumbnails einfügen?
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Das ist eigentlich das, was ich möchte... aber ich hab mich noch nie mit den bildfunktionen befasst.metty84 hat geschrieben:
aber man könte ganz simpel über ne phpfunktion die größe des pics ermitteln und fals es größer ist als das von dir gewünschte maß wird es in der ausgabe automtisch verkleinert dargestellt
Code: Alles auswählen
$max_hight = 400; //maximale bildhöhe
$max_width = 600; //maximale bildbreite
$img_file = 'bildpfad/bild.jpg'; //bildpfad
if ( file_exists($img_file) )
{
$size= getimagesize($img_file);
if ( $size[0] > $max_width || $size[1] > $max_hight )
{
if (($size[0]/$size[1]) > ($max_width / $max_hight))
{
$img_size = 'width="'.$max_width.'px"';
}
else
{
$img_size = 'height="'.$max_hight.'px"';
}
$img = '<a href="'.$img_file.'"><img src="'.$img_file.'" border="0" '.$img_size.'></a>';
}
else
{
$img = '<img src="'.$img_file.'" border="0">';
}
}
else
{
$img = 'Bild existiert nicht';
}
Code: Alles auswählen
// ------------------------------------
// get a random pic from album
// ------------------------------------
if ($album_sp_config['hon_rate_where'] == '')
{
$sql = "SELECT `pic_id`, `pic_filename` FROM " . ALBUM_TABLE . " ORDER BY RAND() LIMIT 1";
}
else
{
$sql = "SELECT `pic_id`, `pic_filename` FROM " . ALBUM_TABLE . " WHERE pic_cat_id IN (" . $album_sp_config['hon_rate_where'] . ") ORDER BY RAND() LIMIT 1";
}
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql);
}
$pic_id_temp = $db->sql_fetchrow($result);
$pic_id = $pic_id_temp['pic_id'];
$max_height = 400; //maximale bildhöhe
$max_width = 600; //maximale bildbreite
$img_file = 'album_mod/upload/'.$pic_id_temp['pic_filename']; //bildpfad
if ( file_exists($img_file) )
{
$size= getimagesize($img_file);
if ( $size[0] > $max_width || $size[1] > $max_height )
{
if (($size[0]/$size[1]) > ($max_width / $max_height))
{
$img_size = 'width="'.$max_width.'px"';
}
else
{
$img_size = 'height="'.$max_height.'px"';
}
}
}
......
'IMG_SIZE' => $img_size,
.....
Code: Alles auswählen
<td class="row1" align="center"><img src="{U_PIC}" border="0" vspace="10" alt="{PIC_TITLE}" title="{PIC_TITLE}" {IMG_SIZE} /></td>