iMinimize erzeugt Thumbnails, bei Click darauf öffnet sich ein Fenster mit dem Bildlink in Originalgröße. Eine feine Sache - wenn übergroße Bilder gepostet werden, wird das Layout des Forums nicht gesprengt. Die Thumbnails ansich werden in einem Ordner "images/thumbs" auf dem FTP abgelegt, welcher auf CHMOD 777 gesetzt ist. In meinem einen Forum funktioniert das bestens, siehe hier - einfach ins Bild clicken:
http://braunforum.web130.server-drome.o ... ?p=704#704
Nur bei ohost.de bekomme ich immer einen "Broken Link" angezeigt (bzw. das Bild "broken_link.gif") aber kein Thumbnail. Es läuft dort exakt dasselbe Forum wie oben.
Liegt das an einer deaktivierten Funktion? Folgende PHP-Funktionen sind bei ohost.de deaktiviert:
- fsockopen
- pfsockopen
- proc_open
- proc_nice
- proc_terminate
- proc_close
- proc_get_status
- shell_exec
- exec
- passthru
- system
- popen
- highlight_file
- file
- diskfreespace
- disk_free_space
- disk_total_space
- show_source
- php_uname
- ini_alter
- ini_restore
- ini_set
- getrusage
- get_current_user
- set_time_limit
- getmyuid
- getmypid
- dl
- leak
Code: Alles auswählen
#
#-----[ COPY ]------------------------------------------
#
preview.php to /
images/broken_link.gif to images/
templates/subSilver/preview_body.tpl to templates/subSilver/
images/thumbs to images/thumbs
##
## Note: You will have to make the following changes to all templates that your board supports
## I use 'subSilver' as an example
##
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN img2 --><a href="preview.php?path={URL}" target="_blank" alt="{L_OPEN_IN_NEW_WINDOW}" title="{L_OPEN_IN_NEW_WINDOW}"><img src="{THUMBNAIL}" border="0" /></a><!-- END img2 -->
##
## Note: You will have to make the following changes to all languages that your board supports
## I use 'English' as an example
##
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// iMinimize_MOD - start
$lang['No_Url'] = 'You haven't specified the picture';
$lang['no_php'] = 'iMinimize doesn't support GD images... yet!';
$lang['In_New_Window'] = 'Open in new window';
// iMinimize_MOD - end
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$bbcode_tpl['img'] = str_replace('{URL}', '\\1\\3', $bbcode_tpl['img']);
// iMinimize_MOD - start
$bbcode_tpl['img2'] = str_replace('{THUMBNAIL}', '\\1', $bbcode_tpl['img2']);
$bbcode_tpl['img2'] = str_replace('{URL}', '\\2', $bbcode_tpl['img2']);
$bbcode_tpl['img2'] = str_replace('{L_RESIZED}',$lang['Resized'],$bbcode_tpl['img2']);
$bbcode_tpl['img2'] = str_replace('{L_OPEN_IN_NEW_WINDOW}',$lang['In_New_Window'],$bbcode_tpl['img2']);
// iMinimize_MOD - end
#
#-----[ FIND ]------------------------------------------
#
return $bbcode_tpl;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// iMinimize_MOD - start
function getsize($url) {
global $userdata;
// Maximum width and height for inpost images
$iWidth = 300;
$iHeight = 0;
// JPEG Quality
$quality = 85;
$base = basename($url);
$base_ext = substr($base, 0, -4);
$id = $userdata['username'] . "_" . $base_ext;
// broken_link
$broken_link = $phpbb_root_path . "images/broken_link.gif";
if(@!$size = getimagesize($url)) {
return $broken_link;
}
$img_size = getimagesize($url);
$real_width = $img_size[0];
$real_height = $img_size[1];
if($real_width > $iWidth OR $real_height > $iHeight) {
// Find the height or width if 0 is the value.
if($iHeight == 0) {
$percent = $size[1] / $size[0] * 100;
$iHeight = round($iWidth / 100 * $percent, 0);
}
if($iWidth == 0) {
$percent = $size[0] / $size[1] * 100;
$iWidth = round($iHeight / 100 * $percent, 0);
}
// Look up the extension of the image and use the right functions.
$cut_url = strlen($url) - 3;
$ext = substr($url, $cut_url);
// .jpg
if($ext == "jpg") {
$im = imagecreatefromjpeg($url);
$ow = imagesx( $im );
$oh = imagesy( $im );
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
imagejpeg( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".jpg", $quality);
imagedestroy( $dstim );
$thumb = $id . ".jpg";
// .gif
} elseif($ext == "gif") {
$im = imagecreatefromgif($url);
$ow = imagesx( $im );
$oh = imagesy( $im );
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
imagejpeg( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".gif");
imagedestroy( $dstim );
$thumb = $id . ".gif";
// .png
} elseif($ext == "png") {
$im = imagecreatefrompng($url);
$ow = imagesx( $im );
$oh = imagesy( $im );
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
imagepng( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".png");
imagedestroy( $dstim );
$thumb = $id . ".png";
// Hvis det skulle være .php endelser!
} elseif($ext == "php") {
$iUrl = $lang['no_php'];
return $iUrl;
// Ellers kan billedet ikke virke!
} else {
return $broken_link;
}
}
$iUrl = "[" . $phpbb_root_path . "images/thumbs/" . $thumb . "]" . $url;
// Hvis billedet nu ikke er for stort!
if($real_width < $iWidth && $real_height < $iHeight) {
$iUrl = "[" . $url . "]" . $url;
}
return $iUrl;
}
// iMinimize_MOD - end
#
#-----[ FIND ]------------------------------------------
#
// Patterns and replacements for URL and email tags..
$patterns = array();
$replacements = array();
#
#-----[ AFTER, ADD ]------------------------------------------
#
// iMinimize_MOD - start
$patterns[] = "#\[img:$uid\]\[(.*?)\](.*?)\[/img:$uid\]#si";
$replacements[] = $bbcode_tpl['img2'];
// iMinimize_MOD - end
#
#-----[ FIND ]------------------------------------------
#
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((ht|f)tp://)([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
#
#-----[ REPLACE WITH ]------------------------------------------
#
// iMinimize_MOD - start
$text = preg_replace("#\[img\]\[(([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))))\]((ht|f)tp://)([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid][\\2]\\2' . str_replace(' ', '%20', '\\5') . '[/img:$uid]'", $text);
// iMinimize_MOD - end
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((ht|f)tp://)([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]' . getsize('\\1'.str_replace(' ', '%20', '\\3')) . '[/img:$uid]'", $text);
#
#-----[ OPEN ]----------------------------------------------------------
#
posting.php
#
#-----[ FIND ]----------------------------------------------------------
#
if ( $post_info['bbcode_uid'] != '' )
{
$message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message);
}
$message = str_replace('<', '<', $message);
$message = str_replace('>', '>', $message);
$message = str_replace('<br />', "\n", $message);
#
#---[ AFTER ADD ]-------------------------------------------------------
#
// iMinimize MOD -start
// Find a picture that belongs to the author and then take the [] out of the message
$handle = opendir($phpbb_root_path . "images/thumbs/");
$posting_user = $post_info['username'];
if($posting_user == "") {
$posting_user = "Anonymous";
}
while (false !== ($thumb = readdir($handle))) {
$message = str_replace("[images/thumbs/" . $thumb . "]", "", $message);
}
// iMinimize MOD -stop
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM