mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Issue #3501 - Media-Manager icon import issue.
This commit is contained in:
@@ -963,6 +963,12 @@ class e_form
|
|||||||
$options['glyph'] = 1;
|
$options['glyph'] = 1;
|
||||||
$options['w'] = 64;
|
$options['w'] = 64;
|
||||||
$options['h'] = 64;
|
$options['h'] = 64;
|
||||||
|
$options['media'] = '_icon';
|
||||||
|
|
||||||
|
if(!isset($options['legacyPath']))
|
||||||
|
{
|
||||||
|
$options['legacyPath'] = "{e_IMAGE}icons";
|
||||||
|
}
|
||||||
|
|
||||||
return $this->mediapicker($name, $default, $options);
|
return $this->mediapicker($name, $default, $options);
|
||||||
|
|
||||||
|
@@ -1303,6 +1303,11 @@ class e_media
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if($category === '_icon') // convert to _icon_16, _icon_32 etc.
|
||||||
|
{
|
||||||
|
$category = $this->getIconCategory($img_data);
|
||||||
|
}
|
||||||
|
|
||||||
$img_data['media_url'] = $tp->createConstants($newpath,'rel');
|
$img_data['media_url'] = $tp->createConstants($newpath,'rel');
|
||||||
$img_data['media_name'] = $tp->toDB(basename($newpath));
|
$img_data['media_name'] = $tp->toDB(basename($newpath));
|
||||||
$img_data['media_caption'] = vartrue($new_data['media_caption']);
|
$img_data['media_caption'] = vartrue($new_data['media_caption']);
|
||||||
@@ -1327,6 +1332,41 @@ class e_media
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Icon Category from image meta data.
|
||||||
|
* @param array $img image meta data.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getIconCategory($img)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($img['media_type'] == 'image/svg+xml')
|
||||||
|
{
|
||||||
|
return "_icon_svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sizes = array(16,32,48,64);
|
||||||
|
|
||||||
|
$dimensions = $img['media_dimensions'];
|
||||||
|
|
||||||
|
foreach($sizes as $dim)
|
||||||
|
{
|
||||||
|
list($w,$h) = explode(" x ", $dimensions);
|
||||||
|
|
||||||
|
if($w == $dim || $h == $dim)
|
||||||
|
{
|
||||||
|
return "_icon_".$dim;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "_icon_64"; // default.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check File-name against mime-type and add missing extension if necessary.
|
* Check File-name against mime-type and add missing extension if necessary.
|
||||||
* @param $path
|
* @param $path
|
||||||
|
Reference in New Issue
Block a user