Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Tutorials Create thumbnails for large images
Chris
Posted on 08 Oct 2006, 21:04:28

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

This is the same method I've used to automatically create thumbnails for large images on the forum

Code:
<?php 
$filename 
= $_GET['file'];
$percent = 0.2;
$font = "arial";
$fontsize = 7;
header('Content-type: image/jpeg');
list(
$width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
$image_p = imagecreatetruecolor($new_width + 2, $new_height + 20);


$backgroundcolor = imagecolorallocate($image_p,5,90,177);
$background = imagefill($image_p,0,0,$backgroundcolor);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 1, 1, 0, 0, $new_width, $new_height, $width, $height);
$tcolor = imagecolorallocate($image_p,255,255,255);
$t = "CLICK TO ENLARGE " . $width . "x" . $height;
$fontwidth = imagettfbbox($fontsize,0,$font,$t);
$g = abs($fontwidth[1]) + abs($fontwidth[2]);

imagettftext($image_p,$fontsize,0,$new_width / 2 - ($g / 2),$new_height + 14,$tcolor,$font,$t);
imagejpeg($image_p, null, 100);
?>


Example:
[img]http://network-13.com/orb.jpg[/img]

Basically what it does is reduces any image passed to it to 20% of its original size, adds a small border and a gap at the bottom where it says CLICK TO ENLARGE and specifies the original size of the image
#36
Last edited by Chris at 2006-10-09 13:02:04 Reason:
Sheika
Posted on 09 May 2009, 13:42:28

Access: Member
Total Posts: 10
Joined: 2009-04-22

how do you implement this?? :eek:
#531
Djdog
Posted on 12 May 2009, 22:18:01

Access: Member
Total Posts: 2
Joined: 2006-09-24

Hosting with GD Support, In most cases every host should have this and shouldn't be a problem.
#536
Philip
Posted on 13 May 2009, 11:40:18

Access: Member
Total Posts: 10
Joined: 2009-05-13

i see that is a simple upload tutorial here,

is it possible to integrate this 2 scripts (simple upload & this one) in the admin/post new area?

and if so, how i can do that?

anyone can help me?

thanks a lot!!!
#539
Network-13.com © 2013