Keyword

K2 Item Image Tab not saving or selecting : MIME detection : Solution

  • Cedryk
  • Cedryk's Avatar Topic Author
  • Offline
  • New Member
More
14 years 5 months ago #84177 by Cedryk
Hello all,

 

I had a problem with K2 items not saving the selected or uploaded image on the Image tab.

The problem was traced and it was found that the MIME type was reporting incorrectly.

 

This appears to be a problem reported in several locations here and the posted fix was to disable the check against the reported MIME type.  Looking at the code, it appeared that the generic method of locating the MIME data file was being used.  This is NOT a good bit of code because it assumes a PHP install using default paths when it fails over.

 

The fix:

 

Locate your administrator/components/com_k2/lib/class.upload.php file and make a backup.

 

In this file, find the following code on or near line 2395:

if (substr(PHP_OS, 0, 3) == 'WIN') {
$path = realpath(ini_get('extension_dir') . '/../') . 'extras/magic';
} else {
$path = '/usr/share/file/magic';
}

 

Replace

$path = '/usr/share/file/magic';
With

// BEGIN MOD 6/4/2010 by PrestoWebsite
$_mmfp = ini_get('mime_magic.magicfile');
if (!empty($_mmfp)) {
$path = $_mmfp;
} else {
$path = '/usr/share/file/magic';
}
// END MOD 6/4/2010

This should take care of most users as it will attempt to get the path from the php.ini file before failing over to the full default install path. 

Hope that helps.

 

Cedryk

PrestoWebsite.com

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum