Answer the question
In order to leave comments, you need to log in
Error opening imagine. How to fix?
Goodnight.
I ran into a problem that I don't understand.
There is a console application that parses ads from a remote server. The ads have pictures.
First, images are uploaded to a temporary directory, then resized, reduced copies are created, and finally transferred to a permanent directory.
But after several iterations of the loop, an error is displayed:
Exception 'Imagine\Exception\RuntimeException' with message 'Unable to open image /home/slonik/localhost/www/test.loc/prodejvuz/frontend/web/cars/tmp_upload/9/6O35536.jpg'
-rw-rw-r-- 1 slonik slonik 64344 мар 20 23:04 0O35536.jpg
-rw-rw-r-- 1 slonik slonik 67230 мар 20 23:04 1O35536.jpg
-rw-rw-r-- 1 slonik slonik 56515 мар 20 23:04 2O35536.jpg
-rw-rw-r-- 1 slonik slonik 59062 мар 20 23:04 3O35536.jpg
-rw-rw-r-- 1 slonik slonik 74374 мар 20 23:04 4O35536.jpg
-rw-rw-r-- 1 slonik slonik 31160 мар 20 23:04 5O35536.jpg
-rw-rw-r-- 1 slonik slonik 216203 мар 20 23:04 6O35536.jpg
drwxr-xr-x 1 slonik slonik 132 мар 20 23:04 mini
public static function resizeImg($dir, $file, $path=null)
{
foreach($file as $value){
if($value != 'mini' && (mime_content_type($path . $value) == 'image/jpeg')){
Image::resize($path . $value, 1200, null)->save($path . $value, ['jpeg_quality' => 80]);
self::thumbnail($value, $path);
Images::writeImg($value, $dir);
}
else{
continue;
}
}
}
public static function thumbnail($file, $path)
{
if(!file_exists($path . 'mini/')){
mkdir($path . 'mini', 0755);
}
Image::thumbnail($path . $file, 274, 210)->save($path . 'mini/' . $file);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question