|
||||
Tutorial: Membuat Gambar Thumbnail
recently aku surf 1 site... jumpa la.. script simple ni.... untuk create thumbnail image ... script untuk membantu sesapa yang nak buat gallery simple ker.. apa apa la...
Fungsi Script:- mengambil gambar asal (pelbagai size) .dari directory.. dan save sebagai gambar thumbnail di directory baru. Size boleh ditentukan sendiri. <?php $thumb_dir = "thumb"; // directory nak letak thumbnail image $dh = opendir("."); // directory gambar asal while ($f = readdir( $dh ) ) { echo call_user_func ('makethumb', $f); } function makethumb($file) { if(eregi("\.(jpg|jpeg)$",$file)) if (!file_exists("$thumb_dir/$file")) { //is it there already? Lets check & find out... $src = ImageCreateFromJPEG($file); $filesize = filesize($file); $org_h = imagesy($src); $org_w = imagesx($src); print "Original Size (<b>W</b>x<b>H</b>): <b>$org_w</b>x<b>$org_h</b> >> "; if ($org_h > $org_w) { $height = 72; // size thumbnail (panjang x lebar $width = floor ($height * $org_w / $org_h); } else { $width = 96; $height = floor ($width * $org_h / $org_w); } $img = ImageCreate($width,$height); ImageCopyResized ($img, $src, 0, 0, 0, 0, $width, $height, $org_w, $org_h ); ImageJPEG($img, "$thumb_dir/$file", 75); print "The file <b>$file</b> has been copied and resized.<br>"; ImageDestroy ($img); ImageDestroy ($src); } else print "The file <b>$file</b> exists already.<br>"; } ?> contoh lain... http://www.weberdev.com/get_example-4032.html Last edited by YajivMalhotra; 01-11-2004 at 10:45 PM. |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ingin membuat sebuah laman web portal mengenai kawasan tempat tinggal. | ikan_semilang | Free Hosting Discussion Forum | 12 | 28-05-2005 10:09 PM |
| @ Pekerja freelance(bebas) membuat website diperlukan | daniel_kradmi | Job Vacancies | 15 | 06-10-2004 01:02 PM |
| url gambar | asamad | Website Design | 20 | 03-10-2004 01:43 PM |
| Gambar & text dlm Flash MX | lktt | Website Design | 2 | 17-09-2002 10:46 AM |
| animasi tulisan & gambar | dwazni | Website Design | 7 | 19-06-2002 09:35 AM |
All times are GMT +8. The time now is 05:27 AM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.












Linear Mode

