• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Importing from sonnb missing most images

dknife

Active member
#1
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?
 

dknife

Active member
#2
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.
 

Chris D

XenForo developer
Staff member
#5
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 ;)
 

dknife

Active member
#6
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