Jump to content

Php script to resize images


uisneach

Recommended Posts

Here:

 

<?php

 

//  Create source image and dimensions

 

$src_img =imagecreatefromgif("bulb_gif.gif");

$srcsize = getimagesize('bulb_gif.gif');

$dest_x = 50;

$dest_y = (50/ $srcsize[0]) * $srcsize[1];

$dst_img = imagecreatetruecolor($dest_x, $dest_y);

//$white = imagecolorallocate($dst_img,255,255,255);

 

 

imagefill($dst_img, 0, 0, $white);

//  Resize image

//imagecolortransparent($dst_img,$white);

 

//imagealphablending($dst_img, 0);

 

imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);

 

//  Output image

header("content-type: image/png");

imagegif($dst_img,'',100);//imagejpeg($dst_img,"",85);

 

//  Destroy images

imagedestroy($src_img);

imagedestroy($dst_img);

 

?>

 

Check it out yourself,

Original pix: http://10-network.net/image_thumbial/bulb_gif.gif

Resized thumbnail:http://10-network.net/image_thumbial/gif.php

 

I hope it helps,

 

Angel

Link to comment
Share on other sites

Hello Angel.

thx ! It's cool

Just a question

this is my viewer.php file which print on video the pic.

echo "thanks for upload pic:";

 

echo "<br />";

echo "number:";

$nesql = "SELECT id_pic, description FROM (SELECT id_pic, description FROM foto ORDER BY id_pic DESC) a LIMIT 1";

$nentry = mysql_query ($nesql);

 

$new = mysql_fetch_row ($nentry);

 

 

echo "<span style='font-size: 16px; font-weight:bold'>  ";

 

 

print_r ($new[0]);

 

 

echo "<br />";

echo "</span>";

echo "<span style='font-size: 16px;font-weight:bold'>name:  ";

print_r ($new[1]);

echo "<br />\n";

echo "<img src = 'http://www.xxxxx.com/public/foto/".$new[0].".jpg' />";

 

echo "</span>";

echo "<br />\n";

 

I am a noob, very sorry, don't know how and where linkin your script with mine.

I think they must be different script, mustn't they?

But  theproblem for me it's to u.s. which varioable to be used here, wher put the link to resize.php

 

hope i am clear

:)

Bye

p.

 

Link to comment
Share on other sites

The upload.php is for the user to upload the file to the DB. The download.php is to retrieve the file from DB.

Once you are able to retrieve the file (pix) you can resize it with the example I first posted.

 

Read the tutorial in the link I gave you.

 

cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.