Jump to content

create image thumbnail


chriscloyd

Recommended Posts

Hi there,
Right now i have a script that uploads an image to my server.  Im having trouble makeing the script to make it a thumbnail ,  so pretty much a problem creating two copies of the file im uploading and making one a thumbnail heres my script so far can someone help me out?

[code]
<?php
include("../config.php");
$id = $_GET['id'];
$get_project = mysql_query("SELECT * FROM projects WHERE id = '$id'");
$project = mysql_fetch_assoc($get_project);
$pclient = $project['clientid'];
$get_client = mysql_query("SELECT * FROM users WHERE id = '$pclient'") or die(mysql_error());
$client = mysql_fetch_array($get_client);
$pname = $client['first'].' '.$client['last'];
$file_name = $HTTP_POST_FILES['screenshot']['name'];
$random_digit = rand(0000,9999);
$new_file_name = "$pname.$random_digit.$file_name";
$path= "screenshots/".$new_file_name;
$pid = $_GET['id'];
copy($HTTP_POST_FILES['screenshot']['tmp_name'],$path);
mysql_query("INSERT INTO project_screenshots (`pid`,`name`,`location`) VALUES ('$pid','$new_file_name','$path')");
header("Location: ../projects.php?page=viewproject&id=$id");
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/35820-create-image-thumbnail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.