View Single Post
  #14  
Old 10-17-2005, 10:33 AM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
yeah...
use this version of creatthumbnail function iside the includes/function.php
PHP Code:
function createthumbnail($file) {
    global 
$pixelpost_db_prefix;
    
$cfgquery mysql_query("select * from ".$pixelpost_db_prefix."config");
    
$cfgrow mysql_fetch_array($cfgquery);
    
// credit to codewalkers.com - there is 90% a tutorial there
    
$max_width $cfgrow['thumbwidth'];
    
$max_height $cfgrow['thumbheight'];
    
define(IMAGE_BASE"../images");
    
$image_path IMAGE_BASE "/$file";
    
$img null;
    
$image_path_exp explode('.'$image_path);
    
$image_path_end end($image_path_exp);
    
$ext strtolower($image_path_end);
    if (
$ext == 'jpg' || $ext == 'jpeg') {
      
$img = @imagecreatefromjpeg($image_path);
        } else if (
$ext == 'png') {
        
$img = @imagecreatefrompng($image_path);
        } else if (
$ext == 'gif') {
        
$img = @imagecreatefromgif($image_path);
        }
    if(
$img) {
        
$width imagesx($img);
        
$height imagesy($img);
        
$scale max($max_width/$width$max_height/$height);
        if(
$scale 1) {
            
$new_width floor($scale*$width);
            
$new_height floor($scale*$height);
            
$tmp_img imagecreatetruecolor($new_width,$new_height);
      
// gd 2.0.1 or later: imagecopyresampled
      // gd less than 2.0: imagecopyresized
            
if(function_exists(imagecopyresampled)) {
                
imagecopyresampled($tmp_img$img0,0,0,0,$new_width,$new_height,$width,$height);
                } else {
                
imagecopyresized($tmp_img$img0,0,0,0,$new_width,$new_height,$width,$height);
                }
            
imagedestroy($img);
            
$img $tmp_img;
            }
        if(
$cfgrow['crop'] == "yes" $cfgrow['crop'] == "12c") {
            
// crop
            
$tmp_img imagecreatetruecolor($max_width,$max_height);
            if(
function_exists(imagecopyresampled)) {
                
imagecopyresampled($tmp_img$img0,0,0,0,$max_width,$max_height,$max_width,$max_height);
                } else {
                
imagecopyresized($tmp_img$img0,0,0,0,$max_width,$max_height,$max_width,$max_height);
                }
            
imagedestroy($img);
            
$img $tmp_img;
            } 
// end crop yes
        
}
    
imagejpeg($img"../thumbnails/thumb_$file",$cfgrow['compression']);
    
$thumbimage "../thumbnails/thumb_$file";
    
chmod($thumbimage,0644);
    } 
this version will be used in the 1.5.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote