Author Topic: Re: Second Thumbnail Size  (Read 8612 times)

0 Members and 1 Guest are viewing this topic.

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Second Thumbnail Size
« on: February 28, 2011, 07:54:09 PM »
thank you sir for reply but problem is still not solved.

I implemented your code on mawenzi code.. i got some error.. please check what did i do wrong?

i have attached the functions.php file..please check if this code is correct.. but i think i applied it correctly.

Please sir look what did i do wrong.
Code: [Select]
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\library\includes\functions.php on line 562===============================================

EDIT :

Sir i think you forgot semicolon ( ; )  in your code after $thumb_height = $thumb_height."px"

i added semicolon.. the error is gone ..but image not coming up.. are you sure your code is working fine?

« Last Edit: February 28, 2011, 08:07:34 PM by haider512 »

Rembrandt

  • Guest
Re: Second Thumbnail Size
« Reply #1 on: February 28, 2011, 08:18:15 PM »
sorry my mistake, i have edit your functions.php (special)
not more as $max = 1  :)  $max=1 is the size of your media files.

$max = 0.5; is half from your media file...
$max = 0.4; is smaller, e.t.c.

mfg Andi
 

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Second Thumbnail Size
« Reply #2 on: February 28, 2011, 08:31:29 PM »
Many Thanks Sir..
Im trying now..

Thanks again..


==================

Sir i increased the size to 2..so the image quality went got poor.. isnt it possible the image quality still remains the same?? its ok if there is way to generate more two images , i mean resize image in two.. as long as image quality is good..

i did 2 in max the image quality got bad.  is there a fix for this?
« Last Edit: February 28, 2011, 09:36:41 PM by haider512 »

Rembrandt

  • Guest
Re: Second Thumbnail Size
« Reply #3 on: February 28, 2011, 10:04:11 PM »
...
Sir i increased the size to 2.....
1.) you can not set $max=2, $max=2 would be the double! of your media file (not thumbnail), that does not work.


2.) i think you have not the right file downloadet, this is the right file:
http://www.4homepages.de/forum/index.php?topic=25017.msg156086#msg156086

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Second Thumbnail Size
« Reply #4 on: February 28, 2011, 10:35:08 PM »
oh! sorry..

i downloaded file and replaced with my one.. the other thumbnail image was very big so i tried to make it smaller ..but its not rezing to small??

i even tried to changed the no to 0.01 but it is same in size and its not getting small??
//################################# Thumbnail small Code ########################################################
function get_thumbnail_small_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_sess$config;

  
$max "0.01"// Factor !

  
if (!check_media_type($media_file_name)) {
    
$thumb "<img src=\"".ICON_PATH."/404.gif\" style=\"border:0px;width:$thumb_width px; height:$thumb_height px;\" />";
  }
  else {
    if (!
get_file_path($media_file_name"media"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);

    
$thumb_width $image_info[0]*$max;
	
	
	
$thumb_height $image_info[1]*$max;
	
	
	
 
$thumb_width $thumb_width."px";
	
	
	
$thumb_height $thumb_height."px";

	
	
$thumb "<img  src=\"".$file_src."\" style=\"border:0px;width:$thumb_width; height:$thumb_height;\"  alt=\"".format_text($image_name2)."\" />";

	
	
}
    else {
      
$file_src get_file_path($media_file_name"media"$cat_id01);
      
$image_info = @getimagesize($file_src);

      
$thumb_width $image_info[0]*$max;
	
	
	
$thumb_height $image_info[1]*$max;

      
$thumb "<img src=\"".$file_src."\" style=\"border:0px;width:$thumb_width; height:$thumb_height;\"  alt=\"".$image_name."\"  />";
    }
  }
  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\">".$thumb."</a>";
    }
  }


  return 
$thumb;
}

//#######################################Thumbnail small Code #######################################################


how to resize it smaller to my specific width and height??

====================================

Hello sir i have IDM. so after applying your php file a .pdf file is automatically trying to download it self. why is that idm is catching file from media folder

its the link which always tries to download it self ..  and also i still couldnt figure out how to resize the image?
« Last Edit: February 28, 2011, 10:49:55 PM by haider512 »

Rembrandt

  • Guest
Re: Second Thumbnail Size
« Reply #5 on: March 01, 2011, 07:31:00 AM »
next version  8)


//################################# Thumbnail small Code ########################################################
function get_thumbnail_small_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_sess$config$site_template;
  
//####### Config ###############################  
  
$maxwidth "150"// pixel
//####### Config ############################### 

  
if (!check_media_type($media_file_name)) {
    
$thumb "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!
get_file_path($media_file_name"media"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);
       
$thumb_width $image_info[0]."px";
       
$thumb_height $image_info[1]."px";
       
$thumb "<img src=\"".$file_src."\" style=\"border:0px;width:$thumb_width; height:$thumb_height;\" alt=\"".format_text($image_name2)."\" />";
    }
    else {
      
$file_src get_file_path($media_file_name"media"$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$thumb_width $image_info[0];
      
$thumb_height $image_info[1];
      
      if (
$thumb_width $maxwidth){ 
        
$imageprop=$maxwidth/$thumb_width;
        
$imagevsize$thumb_height*$imageprop
        
$thumb_width=$maxwidth."px"
        
$thumb_heightround($imagevsize)."px";
      } 
      else{
        
$thumb_width $image_info[0]."px";
        
$thumb_height round($image_info[1])."px";
      }
      
      
$thumb "<img src=\"".$file_src."\" style=\"border:".$config['image_border']."px solid;width:$thumb_width; height:$thumb_height;\" alt=\"".format_text($image_name2)."\">";
    }
  }

  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\">".$thumb."</a>";
    }
  }
  return 
$thumb;
}


mfg Andi

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Second Thumbnail Size
« Reply #6 on: March 02, 2011, 06:07:02 PM »
Thank you sir..your code is working now without blur thing..also now it can be resized to smaller size.. but one more issue is still here.

i have uploaded a pdf file ..and im using my site as eductational purpose .. ppt pdf files etc..

so my download programer automatically is trying to download the pdf file i have uploaded on my 4 images site..

also files with no images should show respective icon.. i mean like if i have uploaded zip file.. it should show zip icon..etc but it instead showing the name of the file?


==============================================

Many Thanks . sir.. little change back to old code in your code ..saved the problem..

many thanks .. superb work sir...

//################################# Thumbnail small Code ########################################################
function get_thumbnail_small_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_sess$config$site_template;

//####### Config ###############################
  
$maxwidth "270"// pixel
//####### Config ###############################

  
if (!check_media_type($media_file_name)) {
    
$thumb "<img src=\"".ICON_PATH."/404.gif\" style=\"border:0;width:$thumb_width ; height:$thumb_height ;\" />";
  }
  else {
    if (!
get_file_path($thumb_file_name"thumb"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);
       
$thumb_width $image_info[0]."px";
       
$thumb_height $image_info[1]."px";
       
$thumb "<img src=\"".$file_src."\" style=\"border:0px;width:$thumb_width; height:$thumb_height;\" alt=\"".format_text($image_name2)."\" />";
    }
    else {
      
$file_src get_file_path($media_file_name"media"$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$thumb_width $image_info[0];
      
$thumb_height $image_info[1];

      if (
$thumb_width $maxwidth){
        
$imageprop=$maxwidth/$thumb_width;
        
$imagevsize$thumb_height*$imageprop;
        
$thumb_width=$maxwidth."px";
        
$thumb_heightround($imagevsize)."px";
      }
      else{
        
$thumb_width $image_info[0]."px";
        
$thumb_height round($image_info[1])."px";
      }

      
$thumb "<img src=\"".$file_src."\" style=\"border:".$config['image_border']."px solid;width:$thumb_width; height:$thumb_height;\" alt=\"".format_text($image_name2)."\">";
    }
  }

  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))." #z1\">".$thumb."</a>";
    }
  }
  return 
$thumb;
}
//------------------------End Thumbnail small



in first else part i changed to $thumb_file_name, "thumb"

from $media_file_name, "media"

now pdf file is not downloading it self.. i mean idm not detecting it..its nice..

Many thanks again..
« Last Edit: March 02, 2011, 06:33:54 PM by haider512 »

 

Post your comments here