BC Photo Gallery Exporter

I am migrating a BC site with hundreds of Photo Galleries to treepl at the moment. I’ve moved more than 100 with more than 250 to go.

I did the first 20 manually to understand the process - it was error prone and time consuming.

I have a semi-automated process now which is fast and accurate - less than 3 minutes to export slides and captions from BC & import into treepl. Unfortunately at least another 2 minutes to remove every 10 slides from Site Search.

This works for me on the site I’m migrating. Hope it is useful to someone else.

Note:

  • there are some very slow parts - expect to wait 20 seconds every time you open the treepl Gallery/Sliders page
  • if you don’t want slides found it in site search it is a very slow process to edit each side, check the don’t index box & save - allow 2 minutes for every 10 slides. There is a request in the Public Backlog to set the don’t index flag during import.

Code Block 1 - Export Photo Gallery Names

Uses Module Data to create a table using the treepl Import Template Structure for Photo Galleries. Create a new page without no template for the code on the BC site. Save the page.

Note: Use Develop Mode to insert the code. The BC Page Editor will move the for loop to the top of the page when the page is saved.

View the web page to see the Photo Galleries table ready to be copied to a spreadsheet for import to treepl.

{module_data resource="photogalleries" version="v3" fields="id,siteId,folderId,photoGalleryName,createDate,lastUpdateDate,folder" skip="0" limit="500" order="photoGalleryName" collection="photoGalleries"}

<table border="1">
    <thead>
        <tr>
            <th>External ID</th>
            <th>Item Name</th>
            <th>Item Description</th>
            <th>Release Date</th>
            <th>Expiry Date</th>
            <th>Weight</th>
            <th>Template ID</th>
            <th>Enabled</th>
            <th>Classifications</th>
            <th>Item Tags</th>
            <th>Created By Member Id</th>
            <th>Author</th>
        </tr>
    </thead>
    <tbody>
        {% for item in photoGalleries.items-%}
        <tr>
            <td></td>
            <td>{{item.photoGalleryName}}</td>
            <td></td>
            <td>02/08/2019</td>
            <td>12/11/2099</td>
            <td>0</td>
            <td>0</td>
            <td>True</td>
            <td></td>
            <td></td>
            <td>0</td>
            <td>0</td>
        </tr>
        {% endfor -%}
    </tbody>
</table>

Code Block 2 - Export Photo Gallery Slide Data

Uses Module Data and the Module PhotoGallery to create a table using the treepl Import Template Structure for Slides. Again, create a new page without no template for the code on the BC site. Save the page.

Note 1: Use Develop Mode to insert the code. The BC Page Editor will move the for loop to the top of the page when the page is saved.

Note 2: All Images are named slide 01 through to slide xx for simplicity - never shows on the rendered gallery.

View the web page to see the Photo Galleries table ready to be copied to a spreadsheet for import to treepl.

{% assign bcGalleryID = 37938 %}   <!-- BC PhotoGalleryID -->
{% assign treeplGalleryFolder= "christysCreek" %} . <!-- Treepl Slide Folder -->

{% assign treeplGalleryPath = "/images/landscape/" %} . <!-- Treepl Folder Path -->
{% assign exportDate = "07/02/2019" %} . <!-- treepl Release Date -->

{% assign treeplGalleryPath = treeplGalleryPath | append: treeplGalleryFolder | append: "/" %}
{% assign slideCounter="00" %}

<!-- get the Gallery Name  to use where a Slide has no description -->
{module_data resource="photogalleries" version="v3" fields="id,photoGalleryName" skip="0" limit="500" order="id" collection="galleryList"}
{% for item in galleryList.items-%}
{% if item.id == bcGalleryID %}{% assign defaultDescription = item.photoGalleryName %}{% break %}{% endif %}
{% endfor -%}

{module_photogallery id="{{bcGalleryID}}" collection="slideList" resultsPerPage="40" template=""}

<table border="1">
    <thead>
        <tr>
            <th>External ID</th>
            <th>Item Name</th>
            <th>Item Description</th>
            <th>Release Date</th>
            <th>Expiry Date</th>
            <th>Weight</th>
            <th>Template ID</th>
            <th>Enabled</th>
            <th>Classifications</th>
            <th>Item Tags</th>
            <th>Created By Member Id</th>
            <th>Author</th>
            <th>Image Src</th>
        </tr>
    </thead>
    <tbody>
        {% for item in slideList.items-%}
		{% assign slideCounter = slideCounter|convert: "number" |plus:1 |convert: "string" |prepend: "0" |slice: -2,2 %}
        <tr>
            <td></td>
            <td>slide {{slideCounter}} </td>
            <td>{%if item.Description != "" %}{{item.Description}}{% else %}{{defaultDescription}}{% endif %}</td>
            <td>{{exportDate}}</td>
            <td>12/11/2099</td>
            <td>0</td>
            <td>0</td>
            <td>True</td>
            <td></td>
            <td></td>
            <td>0</td>
            <td>0</td>
            <td>{{item.link | split: '/' |last | prepend: treeplGalleryPath }}</td>
        </tr>
        {% endfor -%}
    </tbody>
</table>

My Process

I have created 2 pages on the BC site to export the data.

  1. export all the Photo Gallery Names
  2. export the Slide Data for each Gallery (repeated for each Gallery)

Step 1 - Get the Image Files

Export all slides from BC site via FTP so image files are available on my pc ready to upload to treepl.

Step 2 - Export Photo Gallery Names

  1. Export Photo Gallery Names from BC to a web page as a table in treepl import template structure (Code Block 1 above)
  2. Copy table to spreadsheet & save
  3. Import spreadsheet into Gallery/Sliders

All Photo Galleries will be available in treepl. Slides still have to be migrated.

Step 3 - Migrate Photo Gallery Slides to treepl

  1. BC Photo Galleries: Select Photo Gallery and copy PhotoGalleryID from URL in the address bar
  2. BC Admin Console: Past PhotoGalleryID into line 1 of the export code (Code Block 2 above)
  3. treepl File Manager: Create new Folder to store Slides. Copy folder name
  4. treepl File Manager: Upload Slides to Folder
  5. BC Admin Console: Paste folder name into line 2 of the export code (Code Block 2 above)
  6. BC Admin Console: Publish & refresh web page to generate a table of slides for the gallery in treepl Import Template structure
  7. Copy table from web page to spreadsheet & save
  8. treepl Gallery/Sliders: Select Gallery & import spreadsheet
  9. View imported Gallery in treepl website & check it is correct
  10. treepl Gallery/Sliders: Edit each slide, check Disable From Site Search & save
2 Likes

Thank you for sharing @peter.medbury That’s awesome. It’ll be helpful to to whole community so we won’t all need to reinvent these processes. Hopefully soon we’ll get the ability to import all fields including the “Show for search engine field”.