Mystics
Tue 20th May '08, 9:35am
The SMF system did import the thumbnails of SMF 1.1.5 as additional attachments and most attachments were imported wrong because the attachment filename could be encrypted as an option in SMF.
I changed this code in smf/012.php:
if (is_file($dir . '/' . $attachment_details['filename']))
{
$filename = $dir . '/' . $attachment_details['filename'];
}
else
{
$filename = $this->get_name($dir, $attachment_id . '_');
$filename = $dir . '/' . $filename;
# This surley ?
#$filename = $dir . '/' . $this->get_name($dir, $attachment_id . '_');
}
to:
if (substr($dir, -1) == '/')
{
$dir = substr($dir, 0, -1);
}
if (substr($attachment_details['filename'], -6) == '_thumb')
{
// Only thumbnail for an attached image - do not import
continue;
}
$clean_name = strtr($attachment_details['filename'], 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñò óôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiino ooooouuuuyy');
$clean_name = strtr($clean_name, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u'));
$clean_name = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $clean_name);
$encoded_name = $attachment_id . '_' . strtr($clean_name, '.', '_') . md5($clean_name);
$clean_name = preg_replace('~\.[\.]+~', '.', $clean_name);
if (file_exists($dir . '/' . $encoded_name))
{
$realfilename = $encoded_name;
}
else
{
$realfilename = $clean_name;
}
if (is_file($dir . '/' . $realfilename))
{
$filename = $dir . '/' . $realfilename;
}
else
{
$filename = $this->get_name($dir, $attachment_id . '_');
$filename = $dir . '/' . $filename;
# This surley ?
#$filename = $dir . '/' . $this->get_name($dir, $attachment_id . '_');
}