Forum Moderators: coopster

Message Too Old, No Replies

How to create thumbnail and write it to a file

         

lajkonik86

10:22 am on Jan 14, 2005 (gmt 0)

10+ Year Member



Heeyz i'm looking to create a thumbnail and then write it to a file.
But my host seems to be lacking some php extensions. Any goodway of doing this?

Cheers,
Thierry

tomda

10:31 am on Jan 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Thierry,

Have a look if your host should has 'GD_gallery' enable in their PHP_INFO webpage

lajkonik86

2:15 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Yeay think so
<snipped url>

GD Support enabled
GD Version bundled (2.0.28 compatible)
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

[edited by: coopster at 2:56 pm (utc) on Jan. 14, 2005]
[edit reason] removed url [/edit]

lajkonik86

12:52 pm on Jan 15, 2005 (gmt 0)

10+ Year Member



still don't have a good thumbnail script only a very basic version:

// THUMB MAKEN
$name = "imagesb/".$bestandsnaam;
$filename = "imagesb/thumbs/".$bestandsnaam;
$thumb_w = "110px";
$thumb_h = "77px";

if (preg_match("/jpg¦jpeg/",$extl)){
$src_img=imagecreatefromjpeg($name);
}
if (preg_match("/png/",$extl)){
$src_img=imagecreatefrompng($name);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png/",$extl)){
imagepng($dst_img,$filename);
} else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
// eind Thumb Maken

henry0

1:37 pm on Jan 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We have in our Library a great "Bag o'tricks"
Check it out and bookmark it [webmasterworld.com]

A great thread with many tricks

The one you are looking for is within page 2

Regards

Henry