Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in C:\OpenServer\domains\site\inc\account.inc.php on line 91 

There is such a mistake. What is the problem? How to eliminate?

The code itself:

 if ($_FILES['avatar']['tmp_name']) { if ($_FILES['avatar']['type'] != 'image/jpeg') messageSend('error', 'НСвСрный Ρ‚ΠΈΠΏ изобраТСния.'); if ($_FILES['avatar']['size'] > 30000) messageSend('error', 'Π Π°Π·ΠΌΠ΅Ρ€ изобраТСния слишком большой.'); $Image = imagecreatefromjpeg($_FILES['avatar']['tmp_name']); $Size = getimagesize($_FILES['avatar']['tmp_name']); $Tmp = imagecreatetruecolor(100, 100); imagecopyresampled($Tmp, $Image, 0, 0, 0, 0, 100, 100, $Size[0], $Size[1]); if ($_SESSION['USER_AVATAR'] == 0) { $Files = glob('img/avatar/*', GLOB_ONLYDIR); foreach ($Files as $Num => $Dir) { $Num++; $Count = sizeof(glob($Dir.'/*.*')); if ($Count < 250) { $Download = $Dir.'/'.$_SESSION['USER_ID']; $_SESSION['USER_AVATAR'] = $Num; mysqli_query($CONNECT, "UPDATE users SET avatar = $Num WHERE id = $_SESSION[USER_ID]"); break; } } } else $Download = 'img/avatar/'.$_SESSION['USER_AVATAR'].'/'.$_SESSION['USER_ID']; imagejpeg($Tmp, $Download.'.jpg'); imagedestroy($Image); imagedestroy($Tmp); } 

The magic is that imagecreatefrompng () works. Explain to the fool what is wrong? And if it's a govnod, then tell me how to implement the idea more correctly.

  • there are two options, either a broken picture or a broken picture - Naumov
  • @Naumov I checked on different .jpg pictures - Runquaa
  • Before this, what notice is still displayed? - Naumov
  • @Naumov No, they are not displayed. - Runquaa

0