Author Topic: Thumbnail exact size and border style(color rollover etc) ??  (Read 46139 times)

0 Members and 1 Guest are viewing this topic.

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #15 on: June 03, 2010, 08:26:30 PM »
Hi,
    Before using this little change could anyone please let me know what is the use of   resize_image_gd_thumb function ?

Quote
Code: [Select]
function resize_image_gd_thumb($src, $dest, $quality, $width, $height, $image_info) {
  global $convert_options;

$xpos = 0;
$ypos = 0;

      if ($width > $height) {
        $xpos = ceil((($width - $height) / 2) - ($width - $height));
      } elseif ($height > $width) {
        $ypos = ceil((($height - $width) / 2)- ($height - $width));
      } else {
        $xpos = 0;
        $ypos = 0;
      }

  $types = array(1 => "gif", 2 => "jpeg", 3 => "png");
  if ($convert_options['convert_gd2']) {
    $thumb = imagecreatetruecolor(150, 150);
  }
  else {
    $thumb = imagecreate(150, 150);
  }
  $image_create_handle = "imagecreatefrom".$types[$image_info[2]];
  if ($image = $image_create_handle($src)) {
    if ($convert_options['convert_gd2']) {
      imagecopyresampled($thumb, $image, $xpos, $ypos, 0, 0, $width, $height, ImageSX($image), ImageSY($image));
    }
    else {
      imagecopyresized($thumb, $image, $xpos, $ypos, 0, 0, $width, $height, ImageSX($image), ImageSY($image));
    }

    if ($image_info[2] == 3) {
      $quality = 9;
    }

    $image_handle = "image".$types[$image_info[2]];
    $image_handle($thumb, $dest, $quality);
    imagedestroy($image);
    imagedestroy($thumb);
  }
  return (file_exists($dest)) ? 1 : 0;
}

function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
  if (!$image_info) {
    return false;
  }

if ($image_info[0] > $image_info[1]) {
$width = ceil($image_info[0] / ($image_info[1]/150));
$height = 150;
} elseif ($image_info[1] > $image_info[0]) {
$width = 150;
$height = ceil($image_info[1] / ($image_info[0]/150));
} else {
$width = 150;
$height = 150;
}

  $resize_handle = "resize_image_".$convert_options['convert_tool']."_thumb";
  if ($resize_handle($src, $dest, $quality, $width, $height, $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}
I don't see any use of this function and I feel its unnecessary..


Please correct me, if I am wrong..


Thanks,
batu544

Edit: ..  My mistake.. Its working fine.  :mrgreen:  ( my php knowledge is a BIG zero.. )


« Last Edit: June 05, 2010, 11:05:34 AM by batu544 »

Offline mayashu

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #16 on: July 06, 2010, 12:21:19 PM »
I inserted the code in the right place but when I am in admin panel the Auto-Thumbnailer wont load I have a blank page....
I dezactivate the code and is loading. Anyone know how to fix it?
Thanks
Dragos Popovici

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: Thumbnail exact size and border style(color rollover etc) ??
« Reply #17 on: July 06, 2010, 05:06:10 PM »
I inserted the code in the right place but when I am in admin panel the Auto-Thumbnailer wont load I have a blank page....
I dezactivate the code and is loading. Anyone know how to fix it?
Thanks
Dragos Popovici


Restore backups and try again? You must replace the existing entire create_thumbnail function with the new code, not just insert new code.

Thx, this works great, but NOT with the [MOD] Media sites v1.5.6.
For every new video I have to delete the thumbs via ftp, and must use the [Plugin] Rebuild Thumbnails v1.1 to resize it to my square-size manually!
It will be fixed in Media Sites v1.11
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 mayashu

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #18 on: August 24, 2010, 08:31:08 AM »
Thanks it orked fine after removing old code ( I was just coment it)
Thanks

Offline henary

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #19 on: December 12, 2010, 01:58:33 AM »
Hello,

i'd like to use this fine MOD to have all thumb in same dimension 150x100 (ie 3:2 format). The original files will be in 3:2 or 4:3 or something else  :wink: so i'm think i've to calculate something in code.
Did anybody finish this?

I use ImageMagick by defaut in 4img i and change one line
Code: [Select]
$resize_handle = "resize_image_gd_thumb"; to use gd2 for this. May i use better ImageMagick for doing this?

Thanks for any hint,
Henry

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #20 on: March 19, 2012, 05:54:17 PM »
hello

need some help to use the measures as vertical thumbnails, modify the file mentioned in the include and resize the images smaller the perfect, only to climb a vertical image of me taking the measures the horizontal and out deconfigured, how could I do to take steps reverse

width 140 height 280 perfect size
necesito las medidas exactas 280x140

thanks
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline zimba

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #21 on: May 22, 2012, 08:47:22 AM »
Thumbnails  - da wäre ein upgrade ganz sexy das man einfach die Thumbnails so erstellen kann, dass man diese auch als Sahrepics für zB. Facebook nutzen kann - sprich ein optimal Quadratischer Ausschnitt aus dem jeweiligen Bild - im Moment wird ein Bild das zu hoch oder zu wenig hoch ist nicht als Sharepic erkannt. Das es proportional verkleiner wird, ist echt ganz schlecht für die Viralität einer Seite - was gerade bei BILDERN eine grosse Rolle spielt.

Eventuell könnt ihr das in das neue Update einfliessen lassen das man Zeitgemässe "thumbnails" erstellen kann.