You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 146 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - zclassifieds better thumbnails [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
sixonetonoffun
Major
Major


Joined: Jan 13, 2003
Posts: 892


PostPosted: Mon Feb 16, 2004 8:46 am Reply with quoteBack to top

I just did this real quick but is hugely better quality of thumnails. Code is basically scavenged from phphotoalbum by Henning Støverud (Coppermines daddy so to speak)

Ok so here goes written for gd2 (Just change imagecreate function to use with earlier gd versions). There is one variable to set (thumbnails width) $newWidth = 200 change to desired size.

Open modules/ZClassifieds/common.php

Find Near Bottom function makeThumb
Code:

function makeThumb( $scrFile, $dstFile, $dstW=120, $dstH=100 )
   {
      $im = ImageCreateFromJPEG( $scrFile );
      $srcW = ImageSX( $im );
      $srcH = ImageSY( $im );
      $ni = ImageCreate( $dstW, $dstH );
      ImageCopyResized( $ni, $im, 0, 0, 0, 0, $dstW, $dstH, $srcW, $srcH );
      ImageJPEG( $ni, $dstFile );
   }


Replace complete function with:

Code:

   function makeThumb( $scrFile, $dstFile)
   {
// find the image size
 $imginfo = @getimagesize($scrFile);
 if ($imginfo == NULL)
  return false;

 // height/width edit $newWidth to your desired size for thumbnails
 $srcWidth = $imginfo[0];
 $srcHeight = $imginfo[1];
 $newWidth = 200;
 $ratioWidth = $srcWidth/$newWidth;
 $ratioHeight = 0;
 $destWidth = $newWidth;
 $destHeight = $srcHeight / $ratioWidth;
$src_img = imagecreatefromjpeg($scrFile);
    $dst_img = ImageCreateTrueColor($destWidth,$destHeight);
    imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $destWidth,(int)$destHeight, $srcWidth, $srcHeight);
    imagejpeg($dst_img, $dstFile, 100); // Quality = 100
    imagedestroy($src_img);
    imagedestroy($dst_img);
   
return $dstFile;   
   }



This could be done a little better define $newWidth in vars.php instead. But no matter what it makes helluva lot nicer thumbnails that are as close to ImageMagick or NetPBM as we'll get with GD IMHO!

Have Fun! Peter
Find all posts by sixonetonoffunView user's profileSend private message
sixonetonoffun
Major
Major


Joined: Jan 13, 2003
Posts: 892


PostPosted: Mon Feb 16, 2004 8:57 am Reply with quoteBack to top

I have to add that in detail.php around line 80 edit or remove width=\"120\" height=\"100\" to reflect thumbnails new size if changed from 120.

Note* Also the table <td width= % will need adjusting default is 20% and 80% at 200 width I used 30% 70% looks pretty good. There are about 5 instances in default.php
Find all posts by sixonetonoffunView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.429 Seconds - 85 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::