At the moment I have a picture gallery on my site where I have a album gallery doctype with picture doctype as children. On this picture doctype i have a image property that is a upload datatype.
What I want to do now is convert all the pictures to a media itemtype so I can use the multiple file upload and the new pixlr datatype.
Has anybody written a conversion like this before. Otherwise I'll have to figure it out all by myself :-D
I've never heard of anyone doing this before. On the plus side, the upload datatype puts the images in the /media folders so really it's a matter of updating the database so that they show up in the media section.
Do remember to backup your database before attempting this. Okay? Okay.
Or, depending on how many items you've already got it might be easier to simply use the multiple file upload or zipupload packages to put them in the media section directly rather than trying to migrate from one to the other.
Another options would be to just add a media itemtype to your document type, and then let your code handle both scenarios (if media exists, use that, otherwise use upload filed).
Should be relatively easy to do, and would not require any manual work with the existing files.
Here's my scenario: I've created a section in the site called File Library. The content editor had a couple hundred PDF files that she wanted to make available. Rather than have her create a content node and upload each file individually, I had her use the Umbraco File Uploader tool to upload the documents into the Media section of the back-end. I then created a script which created a content node for each document found and then associated the file with the node using the media picker data type.
Here's the problem: Now that all the files are in place, the content editor may add a file here or file there, so that it would be more convenient for her to just upload the file directly when adding the page. The way it's currently setup, in order to add, she has to upload to the Media section, and then create the node and then pick the medai to be associated. Similarly to remove a file (cleanly) she has to delete the content node AND delete the media file. It's a multiple step process that's far too prone to error.
I think Morten's post will work as a short term hack, but I think I'd rather do a cleaner approach and have the files managed consistently. With a few hundred of them, it can become cluttered pretty quickly.
Converting upload datatype to media item
Hi everybody,
At the moment I have a picture gallery on my site where I have a album gallery doctype with picture doctype as children. On this picture doctype i have a image property that is a upload datatype.
What I want to do now is convert all the pictures to a media itemtype so I can use the multiple file upload and the new pixlr datatype.
Has anybody written a conversion like this before. Otherwise I'll have to figure it out all by myself :-D
Dave
I've never heard of anyone doing this before. On the plus side, the upload datatype puts the images in the /media folders so really it's a matter of updating the database so that they show up in the media section.
Do remember to backup your database before attempting this. Okay? Okay.
Or, depending on how many items you've already got it might be easier to simply use the multiple file upload or zipupload packages to put them in the media section directly rather than trying to migrate from one to the other.
Let us know what you find out!
cheers,
doug.
Another options would be to just add a media itemtype to your document type, and then let your code handle both scenarios (if media exists, use that, otherwise use upload filed).
Should be relatively easy to do, and would not require any manual work with the existing files.
I used doug's approach by creating media items through the api for files created with the upload data type.
What if I want to do the exact opposite?
Here's my scenario: I've created a section in the site called File Library. The content editor had a couple hundred PDF files that she wanted to make available. Rather than have her create a content node and upload each file individually, I had her use the Umbraco File Uploader tool to upload the documents into the Media section of the back-end. I then created a script which created a content node for each document found and then associated the file with the node using the media picker data type.
Here's the problem: Now that all the files are in place, the content editor may add a file here or file there, so that it would be more convenient for her to just upload the file directly when adding the page. The way it's currently setup, in order to add, she has to upload to the Media section, and then create the node and then pick the medai to be associated. Similarly to remove a file (cleanly) she has to delete the content node AND delete the media file. It's a multiple step process that's far too prone to error.
I think Morten's post will work as a short term hack, but I think I'd rather do a cleaner approach and have the files managed consistently. With a few hundred of them, it can become cluttered pretty quickly.
Thanks in advance for the advice.
is working on a reply...