Content import with cif "image not found"

Permalink
I am trying to import a large number of pages into concrete 5 using a package and the content import format CIF explained in this documentation:

http://www.concrete5.org/documentation/how-tos/developers/concrete5...

The main problem I am having is that images are not being imported:
<?xml version="1.0"?>
<concrete5-cif version="1.0">
<pages>
  <page
      name="Product Name"
      path="/products/productX"
      filename="" 
      pagetype="product"
      description=""
      package="">
        <area name="Main">
            <block type="image" name="">
                <data table="btContentImage">
                    <record>
                        <fID>{ccm:export:file:filename.jpg}</fID>


This is resulting in an image not found note on the frontend and no images in the filemanager and files folders.

The files are in /packages/mycontent/files/filename.jpg

I have set 777 permissions everywhere. I have also tried:
<fID>{ccm:export:image:filename.jpg}</fID>


Why are these images not importing?

 
nebuleu replied on at Permalink Reply
nebuleu
Same here.

I see two solutions :

1) Before the installation of your content package, put your files in /files/incoming and import them with "Files Manager -> Upload multiple -> Add incoming".

2) If this is a new installation : make a starting point package instead of a standard package. The files should be imported in this case.
nebuleu replied on at Permalink Reply
nebuleu
Finally spend some time to check this problem.

Based on the StartingPointPackage model, you can add the following code to import files in your install() function of your controller.php :
if (is_dir($this->getPackagePath() . '/files')) {
   Loader::library('file/importer');
   $fh = new FileImporter();
   $contents = Loader::helper('file')->getDirectoryContents($this->getPackagePath() . '/files');
   foreach($contents as $filename) {
      $f = $fh->import($this->getPackagePath() . '/files/' . $filename, $filename);
   }
}


https://github.com/concrete5/concrete5/blob/master/web/concrete/core...

I tested it with a custom package who import the content of our current CMS.