• [MOD] Resize wallpaper for restrain resize template. 1 0 5 1
Currently:  

Author Topic: [MOD] Resize wallpaper for restrain resize template.  (Read 55507 times)

0 Members and 1 Guest are viewing this topic.

Offline RezaSalmanzadeh

  • Pre-Newbie
  • Posts: 9
    • View Profile
    • www.Taklyrics.com
[MOD] Resize wallpaper for restrain resize template.
« on: December 10, 2005, 02:24:20 AM »
[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:

Code: [Select]
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)) ? "&amp;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:

Code: [Select]
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)) ? "&amp;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:

Code: [Select]

?>



Add before:

Code: [Select]

//-----------------------------------------------------
//--- 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:

Code: [Select]

<!-- Template file for GIF Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />


Replace with:

Code: [Select]

<!-- 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).


Code: [Select]

<?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  :wink:


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #1 on: December 10, 2005, 04:15:03 AM »
Can we see an example, or a screenshot or something?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)


Offline kj_4fire

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #3 on: December 23, 2005, 02:53:27 AM »
Hello RezaSalmanzadeh & V@no: This Mod works fine, but the only problem here is images appear to be broken if the names of images contains spaces. For exapme: Mypic.jpg show up in detail page, but My pic.jpg or My%20pic.jpg doesnt show up in detail page even though it shows up in Admin CP. Any idea Guys?  :roll:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #4 on: December 23, 2005, 03:16:38 AM »
in image.php try to replace
Code: [Select]
$image = $HTTP_GET_VARS['v'];with:
Code: [Select]
$image = urldecode($HTTP_GET_VARS['v']);
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline kj_4fire

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #5 on: December 23, 2005, 03:34:46 AM »
It is still V@no. It doesnt work  :roll:

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #6 on: December 23, 2005, 05:29:26 AM »
Hi,

is this the same as this....-> http://www.4homepages.de/forum/index.php?topic=9885.0 ????

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #7 on: December 23, 2005, 06:43:20 AM »
It is still V@no. It doesnt work :roll:
And what the error logs say?
can we see it in action?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline kj_4fire

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #8 on: December 23, 2005, 11:58:25 PM »
JensF : sorry, i cant read that language  :|


V@no: There are no the error logs. There is no error at all except some of  images (just some) dont show in detail page. Then i have figured out that all images' names with spaces have that problem. As JensF gave the link above. It appears to be like this in detail page:

http://www.web-upload.de/templates/default/media/jpg.html

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #9 on: December 24, 2005, 04:23:33 AM »
It appears to be like this in detail page:

http://www.web-upload.de/templates/default/media/jpg.html
What I ment, was the page where the images is not shown...not the template (the problem is not in the template)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline vampireus

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #10 on: December 24, 2005, 11:03:48 PM »
I got the same problem




Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #11 on: January 01, 2006, 03:25:40 PM »
the same here.....no one an idea????
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Sir Sky-Walker

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #12 on: January 01, 2006, 06:26:55 PM »
Hallo,

ersteinmal muss ich sagen, echt ein super Mod.
Aber wie kann man beim neuem Fenster das sich beim klicken auf das verkleinerte Bild eine Rechtsklicksperre einfügen?
Ist bei der Hauptseite ja auch.
Ich will nämlich das die bilder über den Downloadbutten runtergeladen wird und nciht mit "Speichern unter". Wird nämlich nciht in der Statistik erfasst!!!

ODer habt ihr dafür eine andere Lösung?
z.B. das die Originalgröße nicht geöffnet wird sondern beim runterladen bekommt man die Originalgröße erst! Wie geht das?

Schonmal Danke

Offline chip

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • pixelmall.de
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #13 on: January 05, 2006, 02:40:40 AM »
Thanks Reza,

it's working fine  :D.


@JensF : hier kann man direkt aufs Bild klicken und die links fallen weg.

Offline Olphi

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: [MOD] Resize wallpaper for restrain resize template.
« Reply #14 on: January 07, 2006, 03:49:08 PM »
Hallo,

ersteinmal muss ich sagen, echt ein super Mod.
Aber wie kann man beim neuem Fenster das sich beim klicken auf das verkleinerte Bild eine Rechtsklicksperre einfügen?
Ist bei der Hauptseite ja auch.
Ich will nämlich das die bilder über den Downloadbutten runtergeladen wird und nciht mit "Speichern unter". Wird nämlich nciht in der Statistik erfasst!!!

ODer habt ihr dafür eine andere Lösung?
z.B. das die Originalgröße nicht geöffnet wird sondern beim runterladen bekommt man die Originalgröße erst! Wie geht das?

Schonmal Danke

Diese Arbeit kannst Du Dir sparen, da man die Rechtsklicksperre sehr sehr einfach umgehen kann, besser wäre es, wenn das Bild gar nicht gross angesehen werden kann, nur heruntergeladen werden! --> der Klick in der details.html wäre somit hinfällig!