hej. Ja det tænkte jeg nok.. Filen hvor brugeren oploader billeder er den nedenstående.. Tror du du kan få sat noget sammen, for jeg kan ikke noget php..
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
|
http://www.php-fusion.co.uk/+--------------------------------------------------------+
| Filename: edit_userprofilepics.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at
www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."useralbum.php";
/* Indstillinger for dit fotoalbum */
$max_width = 700; // max. brede i Pixel
$max_height = 700; // max. højde i Pixel
$max_tn_size = 180; // max. brede/højde for Thumbnails
$max_pics = 20; // max antal bilder der må oploades
$thumbs_per_row = 3; // antal Thumbs pr. række
/* Indstillinger slut */
if (!iMEMBER) redirect("index.php");
opentable(''.$locale['400'].'');
if(IsSet($_POST['deletepic'])) {
@unlink("images/userprofilepics/thumbs/".$_POST['pic_to_delete']);
@unlink("images/userprofilepics/".str_replace('th_','',$_POST['pic_to_delete']));
redirect(FUSION_SELF);
}
echo '
<center><table style="width:450; height: inherit" border="0" cellspacing="1" cellpadding="0" class="tbl-border">
<tr>
';
$i=0;
$found=0;
$pfad="images/userprofilepics/thumbs/";
$verz=opendir($pfad);
while ($file=readdir($verz))
{
if (filetype($pfad.$file)!="dir")
{
$i++;
if($file != substr_count($file,"[".$userdata['user_id']."]")) {
$found++;
$bildinfos = getimagesize("images/userprofilepics/".str_replace('th_','',$file));
echo '
<td valign="bottom" width="33%" class="tbl1" border="0">
<table border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td valign="bottom" border="0">
<a href="java script:;" onClick="popup=window.open(\'images/userprofilepics/'.str_replace('th_','',$file).'\',\'Profilbild'.$i.'\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='.($bildinfos[0]+40).',height='.($bildinfos[1]+50).',left=100,top=100\'); return false;"><img border="0" src="images/userprofilepics/thumbs/'.$file.'" alt=""></a>
</td>
</tr>
<tr>
<td height="22" valign="top" align="center">
<form name="deleteform" method="post" action="'.FUSION_SELF.'">
<input type="hidden" name="pic_to_delete" value="'.$file.'">
<input name="deletepic" type="submit" class="button" value=" Slet ">
</form>
</td>
</tr>
</table>
</td>';
if(Is_Integer($found/$thumbs_per_row)) echo '
</tr></table>
<table style="width:470; height: inherit" border="0" cellspacing="1" cellpadding="0" class="tbl-border"><tr>';
}}
}
closedir($verz);
echo '
</tr>
</table></center>
';
if(IsSet($_POST['upload'])) {
$error="";
$newname_string="[".$userdata['user_id']."]".time();
$newpic = $_FILES['userpic'];
$bildinfos = getimagesize($newpic['tmp_name']);
if($bildinfos[2]<1 || $bildinfos[2]>3) $error='Fejl fil type!';
if(!$error) {
if($bildinfos[2]==1) {
$altesBild=ImageCreateFromGIF($newpic['tmp_name']);
$filetype = ".gif";
}
elseif($bildinfos[2]==2) {
$altesBild=ImageCreateFromJPEG($newpic['tmp_name']);
$filetype = ".jpg";
}
elseif($bildinfos[2]==3) {
$altesBild=ImageCreateFromPNG($newpic['tmp_name']);
$filetype = ".png";
}
if($bildinfos[0]>$max_width || $bildinfos[1]>$max_height) {
if($bildinfos[0]<$bildinfos[1]) {
$new_width = intval($bildinfos[0]/($bildinfos[1]/$max_height));
$new_height = $max_height;
}
elseif($bildinfos[1]<$bildinfos[0]) {
$new_height = intval($bildinfos[1]/($bildinfos[0]/$max_width));
$new_width = $max_width;
}
else { $new_width=$max_width; $new_height=$max_height; }
echo '<br />Dit billede bliver skaleret til '.$new_width.' x '.$new_height.' pixel ...<br />';
}
else {$new_width=$bildinfos[0]; $new_height=$bildinfos[1];}
$neuesBild=imagecreatetruecolor($new_width,$new_height);
ImageCopyResized($neuesBild,$altesBild,0,0,0,0,$new_width,$new_height,$bildinfos[0],$bildinfos[1]);
ImageJPEG($neuesBild,"images/userprofilepics/".$newname_string.".jpg");
$bildinfos = getimagesize("images/userprofilepics/".$newname_string.".jpg");
$altesBild=ImageCreateFromJPEG("images/userprofilepics/".$newname_string.".jpg");
if($bildinfos[0]<$bildinfos[1]) {
$new_width = $bildinfos[0]/($bildinfos[1]/$max_tn_size);
$new_height = $max_tn_size;
}
elseif($bildinfos[1]<$bildinfos[0]) {
$new_height = $bildinfos[1]/($bildinfos[0]/$max_tn_size);
$new_width = $max_tn_size;
}
else { $new_width=$max_tn_size; $new_height=$max_tn_size; }
$neuesBild=imagecreatetruecolor($new_width,$new_height);
ImageCopyResized($neuesBild,$altesBild,0,0,0,0,$new_width,$new_height,$bildinfos[0],$bildinfos[1]);
ImageJPEG($neuesBild,"images/userprofilepics/thumbs/th_".$newname_string.".jpg");
redirect(FUSION_SELF);
}
}
echo '<br />'.$locale['401'].'<br />
'.$locale['402'].' <b>'.$found.'</b> '.$locale['403'].'<br />
'.$locale['404'].' <b>'.$max_pics.'</b> '.$locale['405'].'<br />
'.$locale['406'].' <b>';
$unused = $max_pics - $found;
if($unused<0) $unused=0;
echo $unused.'</b> '.$locale['407'].'<br />
<?<br /><br /><br />
<b>'.$locale['408'].'</b><br />
'.$locale['409'].'<br />
';
echo '<br /><b>Her kan du oploade en fantastisk kupon, som har givet en stor gevinst, og som du har lyst til at vise
til sidens brugere. Tag et screenshot eller et billede af din kupon og opload denne. Det skal være et klart og tydeligt billede!</b><br />';
if(($max_pics-$found)>0) {
echo '
<br />
<hr>
<br />
<b>'.$locale['410'].'</b>
<br /><br />
<div align="center" style="text-align: center;">
<form name="uploadform" method="post" action="'.FUSION_SELF.'" enctype="multipart/form-data">
<input type="file" name="userpic" class="textbox">
<input name="upload" type="submit" class="button" value=" '.$locale['411'].' ">
</form>
</div>';
}
closetable();
require_once THEMES."templates/footer.php";
?>