Fixed Importing from sonnb missing most images

dknife

Well-known member
I'm testing out XFMG on a new server I'm building and duplicated the entire site. When running an import from sonnb - XenGallery, it finds all the albums however it only finds 25 images out of over 5,000 in the database. I've verified all the images are working before running the importer and I turned off sonnb first.

Is there something I'm not doing right?
 
Found issue. sonnb importer assumes Original image option is on, which I have had turned off so it's looking for image files in the data/photos/o directory only. The SonnbXenGallery.php importer needs to be modified to point to the right path for the Large files.

line 363
Code:
$originalFilePath = sprintf('%s/photos/o/%d/%d-%d-%s.%s',
                XenForo_Helper_File::getExternalDataPath(),
                floor($item['content_data_id'] / 1000),
                $item['content_data_id'],
                $item['upload_date'],
                md5('l'.$item['file_hash']),
                $item['extension']
            );

Change '%s/photos/o/%d/%d-%d-%s.%s' to '%s/photos/l/%d/%d-%d-%s.%s'
Change md5('o'.$item['file_hash']), to md5('l'.$item['file_hash']),

line 452
Code:
$xfAttachmentData = array(
                'user_id' => $item['user_id'],
                'upload_date' => $item['upload_date'],
                'filename' => sprintf('%d-%d-%s.%s',
                    $item['content_data_id'],
                    $item['upload_date'],
                    md5('o'.$item['file_hash']),
                    $item['extension']
                ),
                'attach_count' => 1
            );

Change md5('o'.$item['file_hash']), to md5('l'.$item['file_hash']),

@Brogan I'd recommend having a check in the importer for Disable Original Concept in Sonnb to have the path alternate to the Large instead of Original files.
 
Yeah it was the ID I was referring to.

If you could confirm it's that 100% that'd be appreciated. I don't have a current version of the code so I'll basically fix this bug by checking whatever option ID you tell me is correct ;)
 
Sure

Code:
SELECT convert(option_value USING utf8) AS value FROM `xf_option` WHERE option_id = 'sonnbXG_disableOriginal'

Option ticked, result = 1
Option unticked, result = 0

Confirmed that is the option_id
 
I faced the same issue, imported with newest XFMG and SonnbGallery not disable original,very many files were missing in XFMG.

So I downloaded and installed an older version XFMG 1.1.7, then change 'o' to l&m&s
PHP:
$originalFilePath = sprintf('%s/photos/o/%d/%d-%d-%s.%s',
                md5('o'.$item['file_hash']),
it works but many photos was counted 3 times because I did 3 times import for l&m&s, so there're 3 same photos in XFMG.

I have no idea about coding, please help, thanks
 
Last edited:
Back
Top Bottom