það sem ég mælist til er að þú notir forrit sem heitir cjpeg ég nota það sjálfur og það er snilld.
en ef þú ert með rh6.x þá er þetta að finna í <b>libgr-progs-2.0.13-23.i386.rpm</b> en fyrir rh7.x heitir pakkinn <b>netpbm-progs-9.9-5.i386.rpm</b>
Hér að neðan er smá script sem ég gerði
Þær möppur sem þurfa að vera til: ./album og ./thumpnails
SQL dump:
# ——————————————————–
#
# Table structure for table ‘mot’
#
CREATE TABLE mot (
mot_id int(11) NOT NULL auto_increment,
description varchar(255) NOT NULL,
date varchar(30) NOT NULL,
PRIMARY KEY (mot_id),
UNIQUE mot_id (mot_id),
KEY mot_id_2 (mot_id)
);
# ——————————————————–
#
# Table structure for table ‘pictures’
#
CREATE TABLE pictures (
teen_id int(11) NOT NULL auto_increment,
mot_id int(11) DEFAULT ‘0’ NOT NULL,
picture varchar(255) NOT NULL,
thumb varchar(255) NOT NULL,
description text NOT NULL,
sender varchar(255) NOT NULL,
ip_addr varchar(255) NOT NULL,
count varchar(8) NOT NULL,
PRIMARY KEY (teen_id),
UNIQUE teen_id (teen_id),
KEY teen_id_2 (teen_id)
);
<h3>P.S. það getur verið að kóðinn sé soldið messí við að fara hér inn en wtf</h3>
<P><?PHP</P>
<P>// ***********************<BR>// * filename insert.php *<BR>//
***********************</P>
<P>require(“conf.inc.php”);<BR> if ($teensla !=
'none'){<BR> $ending =
$HTTP_POST_FILES['teensla']['type'];</P>
<P><BR> $sql_get_mot =
mysql_query (“SELECT mot_id, description, date from mot order by mot_id DESC”)
or
DIE(“splahhhhh”);<BR>
while(list($str_mot_id, $str_description, $str_date) =
mysql_fetch_row($sql_get_mot))
{<BR>
$teenslu_id =
$str_mot_id;<BR>
}</P>
<P> $djpeg =
“/usr/bin/djpeg”;<BR> $cjpeg =
“/usr/bin/cjpeg”;<BR> $pnmscale =
“/usr/bin/pnmscale”;<BR> $giftopnm =
“/usr/bin/giftopnm”;<BR> $ppmtogif =
“/usr/bin/ppmtogif”;<BR> $ppmquant =
“/usr/bin/ppmquant”;<BR> $nafn =
uniqid(teen);<BR> $path =
“/home/httpd/html/teensla/album/”;<BR>
$tpath =
“/home/httpd/html/teensla/thumbnails/”;<BR> $mynd =
($nafn.“.teen”);<BR> $myndx =
($path.$mynd);<BR> $myndy =
($tpath.$mynd);<BR> $thumb_size = 200;
// pixels<BR> $mynd_size = 700; //
pixels</P>
<P>
//<BR> $album =
“./album/”;<BR> $thumb =
“./thumbnails/”;<BR> $picture =
$album . $mynd;<BR> $thumbnail =
$thumb . $mynd;<BR> $null =
“0”;<BR> //</P>
<P>
if($ending == “image/gif”)
{<BR>
//
thumbnail<BR>
exec(“$giftopnm $teensla | $pnmscale -width $thumb_size | $ppmquant 256 |
$ppmtogif -interlace > $myndy”);</P>
<P>
// shrink
pic<BR>
exec(“$giftopnm $teensla | $pnmscale -width $mynd_size | $ppmquant 256 |
$ppmtogif -interlace > $myndx”);</P>
<P>
$sql = “INSERT INTO pictures (mot_id, picture, thumb, description, sender,
ip_addr, count) VALUES ('$teenslu_id', ‘$picture’, ‘$thumbnail’, ‘$description’,
'$sender', ‘$REMOTE_ADDR’,
'$null')”;<BR>
$result = mysql_query($sql) or
die(“$db_err”);<BR>
echo “<img src=”$thumbnail“ border=0
alt=”$description“><br>”;</P>
<P>
}elseif($ending == “image/pjpeg”) {</P>
<P> </P>
<P><BR>
//
thumbnail<BR>
exec(“$djpeg $teensla | $pnmscale -width $thumb_size | $cjpeg -outfile
$myndy”);</P>
<P>
// shrink
pic<BR>
exec(“$djpeg $teensla | $pnmscale -width $mynd_size | $cjpeg -outfile
$myndx”);</P>
<P>
$sql = “INSERT INTO pictures (mot_id, picture, thumb, description, sender,
ip_addr, count) VALUES ('$teenslu_id', ‘$picture’, ‘$thumbnail’, ‘$description’,
'$sender', ‘$REMOTE_ADDR’,
'$null')”;<BR>
$result = mysql_query($sql) or
die(“$db_err”);<BR>
echo “<img src=”$thumbnail“ border=0
alt=”$description“><br>”;<BR>
}else{<BR>
echo “Not a supported file, this site only accepts jpeg or gif's.<br>Your
were trying to upload
$ending”;<BR>
}</P>
<P><BR> }else{
echo “no picture”; }</P>
<P>// ***************<BR>// * End of file *<BR>// ***************<BR>?></P><hr>
<P><?<BR>// ****************<BR>// * conf.inc.php *<BR>//
****************</P>
<P> // SQL username<BR> $blind_username = “root”;</P>
<P> // SQL hostname<BR> $blind_hostname = “127.0.0.1”;</P>
<P> // SQL Password<BR> $blind_password = “lykilorð”;</P>
<P> // Name of the SQL database that stores your picture
database<BR> $blind_database = “teensla”;</P>
<P> // Connecting to database<BR> @mysql_connect ($blind_hostname,
$blind_username, $blind_password) or die(“splu”);<BR> mysql_select_db
($blind_database);</P>
<P>// ***************<BR>// * End of file *<BR>// ***************<BR>
?></P><hr>
<P><?<BR>// *************<BR>// * index.php *<BR>// *************</P>
<P>require(“conf.inc.php”);</P>
<P><BR> $sql_get_images = mysql_query(“select teen_id, mot_id, picture,
thumb, description, sender, ip_addr, count from
pictures”);<BR> while( list ( $str_teen_id, $str_mot_id, $str_picture,
$str_thumb, $str_description, $str_sender, $str_ip_addr, $str_count) =
mysql_fetch_row($sql_get_images)) {<BR> echo “<a
href=”$str_picture“><img src=”$str_thumb“ border=0
alt=”$str_description“></a> ”;</P>
<P> }</P>
<P>// ***************<BR>// * End of file *<BR>// ***************<BR>?></P><hr>
<P><?<BR>// **************<BR>// * upload.php *<BR>// **************</P>
<P>require(“conf.inc.php”);</P>
<P>$sql_get_mot = mysql_query (“SELECT mot_id, description, date from mot order
by mot_id DESC”) or DIE(“splahhhhh”);<BR> while(list($str_mot_id,
$str_description, $str_date) = mysql_fetch_row($sql_get_mot)) {<BR>echo
“<center><b>$str_description</b></center>”;</P>
<P> }<BR>?></P>
<P><FORM ENCTYPE=“multipart/form-data” ACTION=“insert.php”
METHOD=POST><BR><INPUT TYPE=“hidden” name=“MAX_FILE_SIZE”
value=“1000000”><BR>sendandi:<input type=text
name=sender><br><BR>Lýsing:<input type=text
name=description><br><BR>mynd:<input type=file
name=teensla><br><BR><INPUT TYPE=“submit” VALUE=“Send
File”><BR></FORM></P>
<P><?<BR>// ***************<BR>// * End of file *<BR>//
***************<BR>?></P>
<P> </P>
<P> </P>
<P> </P>
<br><br>:: blindur
:: BNS / blindbylur
::
http://blindur.multiplayer.org