[Mod] Resize wallpaper for restrain resize template.By this mod you can restrain resize your template and create scroll at down your web pages for big pictures or wallpepars, install this mod is easy.
Just 5 files to edit:/includes/functions.php
/lang/english/main.php
/templates/default(or template name)/media/gif.html
/templates/default(or template name)/media/jpg.html
/templates/default(or template name)/media/png.html
& create:image.php
-------[installing]-------Step 1.Open /includes/functions.php
Find:
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) {
global $site_template, $site_sess, $lang, $mode;
if (!get_file_path($media_file_name, "media", $cat_id, 0, 0)) {
$media = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
$site_template->register_vars("iptc_info", "");
}
else {
$media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);
$file_extension = get_file_extension($media_file_name);
$media_icon = "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"".$image_name."\" />";
if ($show_link) {
$media_icon = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$media_icon."</a>";
}
$width_height = "";
$width = "";
$height = "";
$iptc_info = "";
$src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src) : $media_src;
if ($image_info = @getimagesize($src, $info)) {
$width_height = " ".$image_info[3];
$width = $image_info[0];
$height = $image_info[1];
if ($detailed_view && isset($info['APP13'])) {
$iptc_array = get_iptc_info($info['APP13']);
$bgcounter = 0;
foreach ($iptc_array as $key => $val) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$site_template->register_vars(array(
"iptc_value" => $val,
"iptc_name" => $lang['iptc_'.$key],
"row_bg_number" => $row_bg_number
));
$iptc_info .= $site_template->parse_template("iptc_bit");
}
}
}
$site_template->register_vars(array(
"media_src" => $media_src,
"media_icon" => $media_icon,
"image_name" => $image_name,
"width_height" => $width_height,
"width" => $width,
"height" => $height,
"iptc_info" => $iptc_info
));
$media = $site_template->parse_template("media/".$file_extension);
}
return $media;
}
Replace with:function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) {
global $site_template, $site_sess, $lang, $mode, $lang;
if (!get_file_path($media_file_name, "media", $cat_id, 0, 0)) {
$media = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
$site_template->register_vars("iptc_info", "");
}
else {
$media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);
$file_extension = get_file_extension($media_file_name);
$media_icon = "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"".$image_name."\" />";
if ($show_link) {
$media_icon = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$media_icon."</a>";
}
$width_height = "";
$width = "";
$height = "";
$iptc_info = "";
$src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src) : $media_src;
if ($image_info = @getimagesize($src, $info)) {
$width_height = " ".$image_info[3];
$width = $image_info[0];
$height = $image_info[1];
if ($width > $lang['wm_width'] || $height > $lang['wm_height']){
$set = 'true';
}else{
$notset = 'true';
}
if ($detailed_view && isset($info['APP13'])) {
$iptc_array = get_iptc_info($info['APP13']);
$bgcounter = 0;
foreach ($iptc_array as $key => $val) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$site_template->register_vars(array(
"iptc_value" => $val,
"iptc_name" => $lang['iptc_'.$key],
"row_bg_number" => $row_bg_number
));
$iptc_info .= $site_template->parse_template("iptc_bit");
}
}
}
$site_template->register_vars(array(
"set" => $set,
"notset" => $notset,
"lang_wm_gloss" => $lang['wm_gloss'],
"media_src" => $media_src,
"media_icon" => $media_icon,
"image_name" => $image_name,
"width_height" => $width_height,
"width" => $width,
"height" => $height,
"iptc_info" => $iptc_info
));
$media = $site_template->parse_template("media/".$file_extension);
}
return $media;
}
function php_image_creator($width_1, $height_1, $n_width, $n_height, $image, $quality){
header('Content-type: image/jpeg');
$image_p = imagecreatetruecolor($n_width, $n_height);
$image_q = imagecreatefromjpeg($image);
imagecopyresampled($image_p, $image_q, 0, 0, 0, 0, $n_width, $n_height, $width_1, $height_1);
$picture = imagejpeg($image_p, null, $quality);
return $picture;
}
Step 2.Open /lang/english/main.php
Find:
?>
Add before:
//-----------------------------------------------------
//--- Wallpaper MOD -----------------------------------
//-----------------------------------------------------
$lang['wm_gloss'] = "This picture is a wallpaper for view real size please click on picture.";
$lang['wm_width'] = "800"; // This number is width standard for your picture in pixel.
$lang['wm_height'] = "600"; // This number is height standard for your picture in pixel.
$lang['wm_quality'] = "80"; // This number is quality your picture in pixel, best quality is (60 - 100).
You can change width, height or quality wallpapers by 3 array $lang['wm_width'], $lang['wm_height'] and $lang['wm_quality'] (default is 800 X 600).
Step 3.Open /templates/default(or template name)/media/gif.html
Find:
<!-- Template file for GIF Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />
Replace with:
<!-- Template file for GIF Files -->
{if set}<b>{lang_wm_gloss}</b><br /><br /><a target="_blank" alt="{image_name}" href="{media_src}"><img src="image.php?v={media_src}" border="1" alt="{image_name} :: Wallpaper"/></a><br />{endif set}
{if notset}<img src="{media_src}" border="1" alt="{image_name}"{width_height}/><br />{endif notset}
Also for jpg.html & png.html
Step4 .Create an empty php file by name "
image.php" and copy below code to it, then copy "
image.php" to root directory (4image folder).
<?php
/********************************************************************
* ~~~{ In the name of god }~~~ *
* *
* 4images - A Web Based Image Gallery Management System *
* ------------------------------------------------------------ *
* *
* File: image.php *
* Final Revision: 2005/08/31 09:12:21 PM *
* Copyright: (C) 2005 Reza Salmanzadeh *
* Email: Reza_664@yahoo.com *
* Web Site: www.Taklyrics.com *
* Scriptversion: 0.1 *
* *
********************************************************************
* *
* *
* ()()()() ()()()() ()()()() ()() *
* () () () () () () () () *
* () () () () () () () *
* ()()()() ()()() () ()()()()() *
* () () () () () () () *
* () () () () () () () () *
* () () ()()()() ()()()() () () *
* ----------------------------------------------------- *
* *
*******************************************************************/
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
$image = $HTTP_GET_VARS['v'];
$maxwidth = $lang['wm_width'];
$maxheight = $lang['wm_height'];
$quality = $lang['wm_quality'];
if ($image != ""){
$size = getimagesize("$image");
$height_1 = $size[1];
$width_1 = $size[0];
if ($height_1 > $maxheight){
$n_height = $maxheight;
$percent = ($size[1] / $n_height);
$n_width = ($size[0] / $percent);
}else if ($width_1 > $maxwidth){
$n_width = $maxwidth;
$percent = ($size[0] / $n_width);
$n_height = ($size[1] / $percent);
}
if ($n_height > $maxheight){
$n_height = $maxheight;
$percent = ($size[1] / $n_height);
$n_width = ($size[0] / $percent);
}else if ($n_width > $maxwidth){
$n_width = $maxwidth;
$percent = ($size[0] / $n_width);
$n_height = ($size[1] / $percent);
}
php_image_creator($width_1, $height_1, $n_width, $n_height, $image, $quality);
}
?>
// For use this mod php version of server just support "gd" !
Good luck!
Reza Salmanzadeh