Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rick 92 posts 278 karma points
    Nov 27, 2014 @ 17:53
    Rick
    0

    Default image not being set if image not found during import

    Hi,

    Apologies to post on here twice in one week ...

    I'm using Umbraco 7.1.8 and CMS Import 2.5.3

    I'm importing lots of records that are supposed to contain images.

    Despite informing the client that the name of the image must exactly match the name that is in the xml file, something tells me there may be typos or some records simply will not contain an image.

    In my xml file I have the following node:

    /ImportImages/testImage.jpg

    ... where ImportImages is the name of my folder at the root of my Umbraco installation and testImage.jpg is the name of my image in that folder.

    I've successfully mapped my Umbraco property (Header Image) to the xml node (Image) within the CMS Import step and clicked the "green +" icon to set the Media location and Default Value; when I import the record, the media is successfully created in the Media section and the appropriate relationship is set between the Umbraco property and the media item - brilliant stuff.

    However, when I delete the imported record from Umbraco and start the import again; this time I intentionally misspell the name of my image in the xml file to /ImportImages/testImage123.jpg (which doesn't exist inside my ImportImages folder), I get the error:

    The following errors occured

    Error while importing data for property 'headerImage', datasource record URLTitle = 'Test Page', Error :Could not find file 'G:\xxx\xxx\Websites\TestWebsite\ImportImages\testImage123.jpg'.

    ...where "TestWebsite" is the root of my Umbraco website.

    I was under the impression that if it can't find the image, it uses a Default Value, hence setting the Default Value during the Mapping step of CMS Import.

    I've used CMS Import many times, albeit not with Umbraco 7, and I'm certain this used to work.

    Any help / advice would be greatly appreciated.

    Many thanks,
    Rick

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Nov 27, 2014 @ 22:18
    Richard Soeteman
    0

    Hi Rick,

    I will have to check this but I think in the current version it will only take the default image when the value is null, not when the file is missing since that could be a real error.

    Hope this helps for now.

    Best,

    Richard

  • Rick 92 posts 278 karma points
    Nov 28, 2014 @ 10:01
    Rick
    0

    Hi,

    Ah that's a shame - in an ideal world if the file is missing; it would still import the rest of the data in that record as opposed to failing on the entire record.

    Actually, in an ideal world - there wouldn't be missing files in the xml document so this wouldn't happen, but hey ho :-) !

    Thanks,
    Rick

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Nov 29, 2014 @ 07:46
    Richard Soeteman
    0

    Hi Rick,

    Every record fails when assigning a property value that goes into error. With V3 of CMSImport you can specify an extra option. Throw error when file is missing, so when you not use that option you scenario will work. Another reason to update ;-)

    Best,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft