Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Image Upload, ?!?
alex1985
post Apr 9 2008, 07:48 AM
Post #1


Super Member
*********

Group: [HOSTED]
Posts: 387
Joined: 9-February 08
Member No.: 57,615



I need the image upload script which automatically resized the image by specified size and store it in the specified folder.
Go to the top of the page
 
+Quote Post
oestergaard
post Apr 10 2008, 03:13 PM
Post #2


Newbie [Level 3]
***

Group: Members
Posts: 44
Joined: 10-April 08
Member No.: 60,626



google is your friend
Go to the top of the page
 
+Quote Post
alex1985
post Apr 14 2008, 08:27 AM
Post #3


Super Member
*********

Group: [HOSTED]
Posts: 387
Joined: 9-February 08
Member No.: 57,615



So, rude! The forums are created for the aim of helping and assisting people!
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 14 2008, 03:13 PM
Post #4


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,882
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



Google results show 126,000 responses : http://www.google.ca/search?hl=en&as_q...amp;safe=images

Might want to also check out Hotscripts.com : http://www.hotscripts.com/PHP/Scripts_and_...tion/index.html

Try the third one on the Hotscripts list, for example.
http://www.hotscripts.com/Detailed/66112.html
Free, recent and the GD Library is installed on your trap17 account, so it should work fine here.
Go to the top of the page
 
+Quote Post
burhan
post Apr 14 2008, 10:35 PM
Post #5


Newbie
*

Group: Members
Posts: 8
Joined: 16-March 08
Member No.: 59,420



Here is great class for image resize http://www.phpclasses.org/browse/package/1450.html

You can also try www.picTarget.com, they are resizing image and storing in their server.
Go to the top of the page
 
+Quote Post
alex1985
post Apr 15 2008, 05:57 PM
Post #6


Super Member
*********

Group: [HOSTED]
Posts: 387
Joined: 9-February 08
Member No.: 57,615



Ok, I will try to create my own.
Go to the top of the page
 
+Quote Post
obiesan
post May 5 2008, 03:23 AM
Post #7


Newbie [Level 1]
*

Group: Members
Posts: 10
Joined: 5-May 08
Member No.: 61,735



You can use GD_LIB on php, to regenerate new Image with custom resolution. For the class img, u can find in phpclasses.org
Go to the top of the page
 
+Quote Post
alex1985
post May 6 2008, 03:56 AM
Post #8


Super Member
*********

Group: [HOSTED]
Posts: 387
Joined: 9-February 08
Member No.: 57,615



Thanks.
Go to the top of the page
 
+Quote Post
iGuest
post May 27 2008, 11:37 AM
Post #9


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



I need the image upload script which automatically resized the image by specified size and store it in the specified folder.
Image Upload

Replying to alex1985

Try this
==============

<?php

// Connect to database

$errmsg = "";
If (! @mysql_connect("localhost","root","admin")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_db("example");

// First run ONLY - need to create table by uncommenting this
// Or with silent @ we can let it fail every sunsequent time ;-)

$q = <<<CREATE
Create table pix (
pid int primary key not null auto_increment,title text,imgdata longblob)
CREATE;
@mysql_query($q);

// Insert any new image into database

If ($_REQUEST[completed] == 1) {
// Need to add - check for large upload. Otherwise the code
// will just duplicate old file ;-)
// ALSO - note that latest.Img must be public write and in a
// live appliaction should be in another (safe!) directory.
Move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.Img");
$instr = fopen("latest.Img","rb");
$image = addslashes(fread($instr,filesize("latest.Img")));
if (strlen($instr) < 149000) {mysql_query ("insert into pix (title, imgdata) values (\"".$_REQUEST[whatsit]."\", \"".$image."\")");
} else {
$errmsg = "Too large!";
}
}

// Find out about latest image

$gotten = @mysql_query("select * from pix order by pid desc limit 1");
If ($row = @mysql_fetch_assoc($gotten)) {
$title = htmlspecialchars($row[title]);
$bytes = $row[imgdata];
} else {
$errmsg = "There is no image in the database yet";
$title = "no database image available";
// Put up a picture of our training centre
$instr = fopen("../wellimg/ctco.Jpg","rb");
$bytes = fread($instr,filesize("../wellimg/ctco.Jpg"));
}

// If this is the image request, send out the image
If ($_REQUEST[gim] == 1) {
Header("Content-type: image/jpeg");
print $bytes;
exit ();
}

?>

<html><head>
<title>Upload an image to a database</title>
<body bgcolor=white><h2>Here's the latest picture</h2>

<font color=red>
<?=
$errmsg
?>
</font>


<img src=?gim=1 width=144><br>

<?=
$title
?>







<hr>
<h2>Please upload a new picture and title</h2>
<form enctype=multipart/form-data method=post>
<input type=hidden name=MAX_FILE_SIZE value=150000>
<input type=hidden name=completed value=1>
IMAGE: <input type=file name=imagefile><br>
NAME: <input name=whatsit><br>
PRESS: <input type=submit></form><br>
<hr>



</body>
</html>


-reply by Binu K James