![]() |
[استفسار] دالة تقليل حجم الصورة فيها مشكلة رمز PHP: function image_quality_reduce($file) { $quality = 20; $file_extension = explode('.', $file); $ext = strtolower($file_extension[count($file_extension) - 1]); if(in_array($ext, array('jpg', 'jpeg', 'png'))) { $image = imagecreatefromstring(file_get_contents($file)); } else { return false; } $ext == 'jpg' || $ext == 'jpeg' ? imagejpeg($image, $file, $quality) : null; $ext == 'png' ? imagepng($image, $file, $quality) : null; } تضهر لي الخطأ عندما أرفع صيغة Warning: file_get_contents(uploads/1/avatar/f6fb2.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\www\upload_avatar.php on line 28 Warning: imagecreatefromstring(): Empty string or invalid image in C:\xampp\htdocs\www\upload_avatar.php on line 28 Warning: imagejpeg() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\www\upload_avatar.php on line 34 ماهو الحل برأيكم التحكم بحجم تقليل الصورة من $quality = 20; هنا الجودة جعلتها قليلة جدا وهي 20 |
الساعة الآن 01:11 PM |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By
Almuhajir