Found that error message in the code:
It means your browser reported an unsupported mime-type, or as you tried it with png and jpeg it probably reported “application/octet-stream”. Please give my following fix a try:
function save_picture($file,$resouce_id)
{
switch($file['type'])
{
case 'image/gif':
$src_img = imagecreatefromgif($file['tmp_name']);
break;
case 'image/jpeg':
case 'image/pjpeg':
$src_img = imagecreatefromjpeg($file['tmp_name']);
break;
case 'image/png':
case 'image/x-png':
$src_img = imagecreatefrompng($file['tmp_name']);
break;
case 'application/octet-stream':
$file['type'] = Api\MimeMagic::filename2mime($file['tmp_name']);
return $this->save_picture($file, $resouce_id);
default:
return $file['type'].': '.lang('Picture type is not supported, sorry!');
}
$tmp_name = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'resources-picture');
imagejpeg($src_img,$tmp_name);
imagedestroy($src_img);
Link::attach_file('resources',$resouce_id,array(
'tmp_name' => $tmp_name,
'name' => self::PICTURE_NAME,
'type' => 'image/jpeg',
));
}
Let me know if that fixes the problem for you, then I will add it to next maintenance release.
It also reports not the mime-type as part of the error.
Ralf