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

0 Members and 1 Guest are viewing this topic.

Offline nikitaspj

  • Newbie
  • *
  • Posts: 10
    • View Profile
Thumbnail exact size and border style(color rollover etc) ??
« on: January 30, 2008, 04:50:13 PM »
what i want to do is to be able to have all the thumbs the same size
and ..
to be able to change the thumb border color  , AND OR , to make a rollover effect (from a change border color to that lens-blur effect)

It is real important to have access to these settings if u want to create descent templates,even if u will not use them,

Offline nikitaspj

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #1 on: February 04, 2008, 11:54:14 PM »
Hallo ?  anybody  ?

Offline nikitaspj

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #2 on: February 07, 2008, 02:29:05 PM »
Hallo Hallo somebody ?
After seven days a reply ?
I complain a little
« Last Edit: February 07, 2008, 06:03:53 PM by nikitaspj »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #3 on: February 07, 2008, 02:50:23 PM »
hi,

if you want to have all thumbs same size, you have to have all pics in same size..

example 1024x1024

you will have thumbs in same size...

different pics can not have same thumb size.. except you want to set width and height by your own (pics will be streched)..
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #4 on: February 07, 2008, 02:53:25 PM »
1. Settings in ACP -> General -> Settings -> Upload Settings -> Thumbnail Size / Proportions ...
2. try this ... http://www.4homepages.de/forum/index.php?topic=4598.msg52675#msg52675
3. for rollover with blur effect use css coding ... like here ... www.myart.es
... and ...
4. we dont need several postings for the same request ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline nikitaspj

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #5 on: February 07, 2008, 06:24:09 PM »
I noticed that u were working on a BugFix release these days.
So excuse me for complaining a bit ,for the delay , i understand that u were surrounded by code .
And that many users they recieve free help.And this is respected.
It is just that i purchased a license only for the customer support
So excuse me if i shaked the tree the wrong time

As for the request.
I want the thumbs to be an exact width and height but not to be streched.Example i might want them square but not to stretch the thumbs.Is there ANY way to do that ?

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #6 on: February 07, 2008, 06:52:58 PM »
... I think, I'm not the right person for your "customer support problem" ...
... I'm only a member of this community ...
... developers, distributors, administrators are Jan and Kai ...

for the request
... I think there is a request with some code snippets in the forum "Mods & Plugins (Requests & Discussions)" by "trez" ...
... but I don't know if that works for your special request ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline a_rojilla

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #7 on: February 11, 2008, 04:27:09 AM »
For non-distorted square thumbs (first the thumb is created with a minimum height or width -depending on if the image is horizontal or vertical- and then the final thumbnail is extracted from the center  -this, of course, won't affect to already square images), follow these steps:

1.- Open includes/image_utils.php

2.- Find the function create_thumbnail (near the end), it's all this code:

Code: [Select]
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;
  }
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}

3.- Select all that code and either remove or comment it (the latter is a better option just in case you need the code again).

4.- Paste this code just where the removed code was (or if you just commented it out, paste the code either before of after the commented code -it doesn't matter):

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;
  }
}

5.- In this code, look for the number 150 and replace it with the size you want for your thumbs (if you want 80x80 thumbs then replace every 150 with a 80).

That's all. Now, let me tell you this: this should work even if you added some MODs to image_utils.php (like that for an image height bug when resizing, I remember), but just be careful if you modified the file before. And, most importantly, the code I posted will only work if you use GD as your converter (I tested the code with GD2).

Good luck and, please tell me if it worked for you.

Regards.

Forgot to say: if you set 150, or 80, whatever, as the size for your thumbnails, note that samller images will be scaled up (if you set 150 and someone uploads a, say, 100x100 image, it will be resized to fill the 150 pixel space -so remember that the size for your thumbnails will be a fixed size and the best you can do is to not upload images smaller than taht size -anyway, does it make sense to upload images smaller than the thumbnails themselves?).
« Last Edit: February 11, 2008, 06:32:11 AM by a_rojilla »

Offline nikitaspj

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #8 on: February 27, 2008, 04:11:41 PM »
a_rojilla T H A N X !

It works ok until now (some tests ) and the good thing is that it does not affect or get affected even when i Resize thumbs from the AutoImage Resizer.
I have to tell you that your reply saved me
again THANX !

Offline a_rojilla

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #9 on: March 01, 2008, 12:19:50 PM »
It works ok until now (some tests ) and the good thing is that it does not affect or get affected even when i Resize thumbs from the AutoImage Resizer.

Nice to hear/read it works for you as well. I guess this could be published as a new MOD for those who also want square thumbs (they are easier to work with -for making rows, columns or mosaics-, more pleasant to look at and even a little more effective since hidding some parts of the final image may encourage some clicks).

Regards.

Offline weissinger

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #10 on: April 15, 2009, 07:48:02 PM »
Hello.

Nice Codesnippet!
But I use imagemagick.
What should I change that I can
create square thumbs with imagemagick?  :roll:

Thanks.


Offline Sebas Bonito

  • Sr. Member
  • ****
  • Posts: 271
  • Sebas Bonito
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #11 on: July 07, 2009, 03:42:13 PM »
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!

Offline Sebas Bonito

  • Sr. Member
  • ****
  • Posts: 271
  • Sebas Bonito
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #12 on: July 16, 2009, 06:14:04 PM »
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!

PUSH

I really need help in this  :|

Offline Maria2009

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #13 on: August 05, 2009, 03:54:17 AM »
thanks so much for useful info

keyword

Rembrandt

  • Guest
Re: Thumbnail exact size and border style(color rollover etc) ??
« Reply #14 on: August 05, 2009, 05:20:05 AM »
Hi!
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!
und was genau funktioniert nicht, b.z.w was möchtest du?

mfg Andi