Jump to content

problem with avatar uploading


Ristiisa

Recommended Posts

Hello,i have problem,i have the avatar uploading on game,but it says "Je avatar voldoet niet aan de eisen" in english its "Your avatar does not meet the requirements"

 

heres the code

 

<?php
  if(isset($_POST['bewerken'])) {
      if($_FILES['afbeelding']['type'] == "image/pjpeg") {
          if($own['avatar'] != "images/avatars/empty.jpg") {
            unlink($own['avatar']);
          }
          $uploadedfile = $_FILES['afbeelding']['tmp_name'];

          $src = imagecreatefromjpeg($uploadedfile);

          list($width,$height)=getimagesize($uploadedfile);

          $newwidth = ($width < 100) ? ($width) : (100);
          $newheight = ($height < 100) ? ($height) : (100);
          $tmp=imagecreatetruecolor($newwidth,$newheight);

          imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

          $filename = 'images/avatars/' . $own['id'] . md5($_FILES['afbeelding']['tmp_name']) . '.jpg';
          imagejpeg($tmp,$filename,100);

          imagedestroy($src);
          imagedestroy($tmp);

          mysql_query("UPDATE users SET avatar = 'images/avatars/" . $own['id'] . md5($_FILES['afbeelding']['tmp_name']) . ".jpg' WHERE id = '" . $own['id'] . "'");

          echo'Je hebt het plaatje opgeslagen.<br /><br />';
          missiondone(2);
      } else {

          echo'Je avatar voldoet niet aan de eisen.<br /><br />';
      }
  }
echo'
Het plaatje moet een jpg extensie hebben. Hij wordt automatisch naar het formaat 100 x 100 verkleind.
<form method="post" enctype="multipart/form-data">
Upload:<br />
<input type="file" name="afbeelding" class="input"><br />
<input type="submit" value="Uploaden" name="bewerken" class="submit">
</form>';
?>

 

 

please help,thanks.

Link to comment
https://forums.phpfreaks.com/topic/199649-problem-with-avatar-uploading/
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.