Author Topic: original images resized  (Read 6300 times)

0 Members and 1 Guest are viewing this topic.

Offline Eder

  • Pre-Newbie
  • Posts: 8
    • View Profile
original images resized
« on: November 18, 2006, 12:32:23 PM »
Hi,

Sorry if exists a topic with this mod but I have been trying to find it but nothing.. :(

Before I had another version of 4images and I had a great mod for the resizing of the big images without creating another image with other domensions. It was the original mges but resize and with a message upon the pic saying that the pic was resized.

The code was this:

Quote
in "functions.php" 3 new lines:

// HV : resize to fit layout if necessary
      unset($resized);
      $dispwidth = 548;
      if ($width > $dispwidth) {
        $picratio = $height / $width;
        $dispheight = floor($picratio * $dispwidth);
        $width_height = " width=\"". $dispwidth . "\" height=\"" . $dispheight . "\"";
        $resized = 1;
      }
// end HV
 
      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,
// HV : resize to fit layout if necessary
      "resized" => $resized,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "dispwidth" => $dispwidth,
      "dispheight" => $dispheight,
      "iptc_info" => $iptc_info
    ));


And in the "details.html" other new lines:

{if resized} The image on this page is reduced in size.
{download_button} to get the original size ({width} x {height} pixels).
{endif resized}

I would like to have this in the last version of 4images and the mods i have found what they do is creating another big thmbnail of 800x600 for example and when you click it a new window is opened with the original pic, but what I would like to have is the original pic but resized proporcionally with the message upon it and then when you download it with right buttom you could see in full size in the PC.


Thanks in advance! and sorry for my english jeje :mrgreen:

Offline boismenu

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: original images resized
« Reply #1 on: November 20, 2006, 04:20:25 AM »
This is exactly what I´m looking for :!:
So you say this code doesn´t work on new php and/or 4images software. I´m new to php programming but I´m sure functions.php can be modified to do something like you did. I´ll give it a try, but suggestions are welcomed  :D

boismenu

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: original images resized
« Reply #2 on: November 20, 2006, 02:25:07 PM »
With this mod here, you can set the max height or width a image is allowed to display and it will resize the image proportionally without altering or creating a new image.

http://www.4homepages.de/forum/index.php?topic=9885.0

But I don't know about the text part, maybe you will  be able to modify the above mod to show this text

Offline Eder

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: original images resized
« Reply #3 on: November 22, 2006, 09:17:35 AM »
Lots of thanks!!! So the mod that do what I wanted is this one:


1. 'Go to includes/functions.php'

Find:

      if ($image_info = @getimagesize($src, $info)) {
        $width_height = " ".$image_info[3];
        $width = $image_info[0];
        $height = $image_info[1];


Add after:

   unset($resized);
   if ($width > 620)
   {
                      $new_limit = "624";
                      $limit_var = "width";
         $resized = 1;
     }
     else
   {
                   $new_limit = $image_info[0];
                  $limit_var = "width";
          $resized = 0;
   }



Find:

"&amp;mode=".$mode : ""))."\">".$media_icon."</a>";
    }
    $width_height = "";
    $width = "";
    $height = "";


Add after:

    $limit_var = "";
    $new_limit = "";



Find:

      $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,


Add after:

      "new_limit" => $new_limit,
      "resized" => $resized,
      "limit_var" => $limit_var,




2. Go to 'templates\default\details.html'

Find:

{image}

Add 'before':

{if resized} The image has been resized automatically.
Download it for seeing it in its original size ({width} x {height} pixels).
{endif resized}



Find:

{image}

Change it with:

<a href="{media_src}" target="_blank">{image}</a>



3. Go to 'templates\default\media\jpg.html':

Find:

<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />

Change it with:

<img src="{media_src}" border="0" alt="{image_name}" {limit_var}="{new_limit}" />


And that's all!! :P

Offline unite

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: original images resized
« Reply #4 on: January 22, 2007, 10:10:24 PM »
Works great thanks