'typo3: Migrate internal_type=file_reference to FAL

I have an older typo3 site which uses image pickers with the following code:

    'tx_my_image' => array(
        'label' => 'Image',
        'exclude' => 1,
        'config' => array(
            'type' => 'group',
            'internal_type' => 'file_reference',
            'allowed' => 'gif,jpg,jpeg,png',
            'show_thumbs' => 1,
            'size' => 1,
            'maxitems' => 1,
            'minitems' => 0,
        )
    ),

This does not work any more in typo3 10 (Error: "TCA internal type of field tx_my_image in table pages must be set to "db" or "folder"."). So I changed it to look like this:

    'tx_my_image' => array(
        'label' => 'Image',
        'exclude' => 1,
        'config' => ExtensionManagementUtility::getFileFieldTCAConfig('tx_my_image', [
            'show_thumbs' => 1,
            'size' => 1,
            'maxitems' => 1,
            'minitems' => 0
        ], 'gif,jpg,jpeg,png'),
    ),

Which works in the sense that the backend doesn't throw fatal errors any more, but my problem now is that all the previously selected images are no longer found. Before, the path of the images was simply stored in a field "tx_my_image" in the pages table (it's probably not a good idea to that, but it was like this already when I started maintaining the site).

There is a huge number of pages in this site, so manually redoing all the image selection is completely unfeasible. So my question is, is there a way to either convert my old data to whatever format the new typo3 version expects, or better yet, a way to configure the form so that it finds the data in its current form?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source