How to give image path in excel file, where to save images in kentico,so that after importing data v

Ranapratap Bhopale asked on July 5, 2018 16:38

I want to import data into kentico pages,there is one field for photo(ie.media selection).I have 1000 records and its not possible to upload and add path for each record. Please tell me, How to give image path in excel file, where to save images in kentico,so that after importing data via toolkit it automatically match that path to image.

Correct Answer

Brenden Kehren answered on July 5, 2018 16:56

I'd suggest using the media library for your images. In the Excel sheet, if you have at least the name of the image stored, you can concatincate the actual URL based on the file placmeent in the media library.

Create the media library in Kentico. Find the directory in the file system. Typically under /cms/<sitecodename>/media/<medialibrarycodename>. Example for MySite with library named images would be /cms/MySite/media/images.

Next, copy the files into that directory in the file system: /MySite/media/images.

Then, in you're Excel sheet, update the filename to prepend /MySite/media/images/ to the file name. This will get you the relative link you're looking for in that document.

Lastly, you'll need to go into the media libaray and import all the images.

0 votesVote for this answer Unmark Correct answer

Recent Answers


vasu yerramsetti answered on July 7, 2018 10:10 (last edited on July 7, 2018 10:13)

@Ranapratap,

Please follow below steps to import images into Media library and update the image path in Page Type

Steps:

  1. Keep all the images in one Physical folder
  2. Update excel file with DocumentID and ImagePath Eg: DocumentID | ImagePath ---> 154|D:\Importimages\Image.png [Sample data in Excel file]
  3. Implement custom code for Import/Update Media files using Kentico Media library API. Refer URL https://docs.kentico.com/api9/content-management/media-libraries#Medialibraries-Creatingamedialibraryfile
  4. In the same code add update document content based on documentID using the Kentico Page API. Refer URL https://docs.kentico.com/api9/content-management/pages#Pages-Updatingapageandrelatedsearchindexes

Logic as follows ,

  1. Read excel file data
  2. Check Media library availability(Provide media library name/ID) and read the Image path from excel file
  3. Create a new media file
  4. Get Media file path after successful creation media file in Media library
  5. Update document based on the documentID with Media library image path i.e., from step 4

Note: You can implement this logic in web part/any aspx page[code behind]

I hope this will help you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.