Приветствую всех! Не загружает heic фотографии.
С png и jpg все отлично. Добавил mimetype "image/heic", но не сработало.
В чем может быть проблема?
Может дело в строчке кода ??? :
$uploadfile = $uploaddir . md5(basename($_FILES['image']['name'][$i]).time()).(($type=='image/jpeg')?'.jpg':'.png');
Полный код:
if($res){
if(count($_FILES['image'])){
#include MODX_ASSETS_PATH . 'test.php';
foreach($_FILES['image']['type'] as $i=>$type){
if(in_array($type,['image/jpeg','image/png', 'image/heic', 'image/heif']) && $_FILES['image']['size'][$i]<6000000){
$uploaddir = '/assets/images/anketa/'.$profile->get('id').'/';
mkdir(MODX_BASE_PATH.$uploaddir, 0755);
//mkdir(MODX_BASE_PATH.$uploaddir."sssssssss", 0755);
$uploadfile = $uploaddir . md5(basename($_FILES['image']['name'][$i]).time()).(($type=='image/jpeg')?'.jpg':'.png');
//var_dump($uploadfile);
if (move_uploaded_file($_FILES['image']['tmp_name'][$i], MODX_BASE_PATH.$uploadfile)) {
chmod(MODX_BASE_PATH.$uploadfile, 0755);
$images[] = ['image' => $uploadfile];
}
}
}
if(count($images)){
$i = 1;
foreach($images as $key=>$image){
$images[$key]['MIGX_id'] = $i;
$i++;
}
}
}
$profile->setTVValue('photo',json_encode($images));
if(count($images)) {
reset($images);
$profile->set('profileimg', $images[0]['image']);
}
$profile->save();
$modx->cacheManager->clearCache();
/*$key = $profile->getCacheKey();
$cache = $modx->cacheManager->getCacheProvider($modx->getOption('cache_resource_key', null, 'resource'));
$cache->delete($key, array('deleteTop' => true));
$cache->delete($key);*/
$url = $modx->makeUrl($profile_id?array_search($profile->get('parent'),$cat_arr):$_GET['cat']);
$modx->sendRedirect($url);
}