Where is media folder Id stored in Umbraco database? - umbraco

URL for an image in Umbraco looks like /media/[Media Folder ID]/[Image name].[Image extension]
Where can I find this [Media Folder ID] in the database?

As far as I am aware, Umbraco doesn't store media image folder in the DB.
You can refer to this post to find out where the default media folder is defined:
https://our.umbraco.org/forum/using-umbraco-and-getting-started/77409-upload-media-files-to-folder-extend
The 4 digit ID media folder names found in the "Media" folder are referenced in the various content parts in the DB depending where you have added the particular images (as properties on the nodes).

Related

Copy folders into Azure data storage (azure data factory)

I am trying to copy folders with their files from ftp into an azure data storage, by looping through the folders and for each folder copy the content into a container that has the folder's name. for this, I used a metadata ,for each and copy data component. For now I am able to copy all the folders into the same container , but what I want is to have multiple containers named after the the folders in the output, each one containing files from the ftp.
ps : I am still new to azure data factory
Any advise or help is very welcome :)
You need to add a Get Metadata activity before the for-each. The Get Metadata activity will get the files in the current directory and pass them to the For-Each. You connect it to your Blob storage folder.
try something like this
Setup a JSON source:
Create a pipeline, use GetMetadata activity to list all the folders in the container/storage. Select fields as childItems
Feed the Metadata output (list of container contents) into filter activity and filter only folders.
Input the list of folders to a ForEach activity
Inside ForEach, set the current item() to a variable, and use it as a parameter for a parameterized source dataset which is a clone of original source !
This would result in listing the files from each folder in your container.
Feed this to another filter and this time filter on files. Use #equals(item().type,'File')
Now create another pipeline where we will have our copy activity running for each file found to be having same name as that of its parent folder.
Create parameters in the new child pipeline to receive the current Folder and File name in the iteration from Parent Pipeline to evaluate for copy.
Inside child pipeline, start with foreach whose input will be the list of filenames inside the folder received into parameter: #pipeline().parameters.filesnamesreceived
Use variable to hold the current item and use IfCondition to check if filename and folder names match.
Note: Try to evaluate dropping the file extension as per your requirement as metadata would hold the complete file name along with
its extension.
If True - > the names match, copy from source to sink.
Here the hierarchy is preserved and you can also use "Prefix" to mention the file path as it copies with preserving hierarchy. It utilizes the service-side filter for Blob storage, which provides better performance than a wildcard filter.
The sub-path after the last "/" in prefix will be preserved. For example, you have source container/folder/subfolder/file.txt, and configure prefix as folder/sub, then the preserved file path is subfolder/file.txt. Which fits your scenario.
This copies files like /source/source/source.json to /sink/source/source.json
AzCopy is simplest solution for this than Data factory, dry run can be used to check which files/folders will be copied
az storage blob copy start \
--destination-container destContainer \
--destination-blob myBlob \
--source-account-name mySourceAccount \
--source-account-key mySourceAccountKey \
--source-container myContainer \
--source-blob myBlob

Where does active storage store files (on disk), and how can I retrieve them physically?

I am using active storage with Rails 5.2. I am following the EdgeRails guide, and have configured Active-Storage to use the local disk.
The file uploads work great when I am using the Rails App.
However, the problem is that I need to physically access those uploaded files without using Rails as a mediator.
A query for where the files are stored returns this:
url_for(#employee_staff.avatar)
=> "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBGUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--e76664d247cb5437fe1cd11f7ee0ded24f95aee2/profilepic3.jpeg"
I am trying to figure out where this file path is saved in my local disk. So far, I've had no luck.
Any explanations about how Active-Storage works and where I can see the uploaded files are greatly appreciated.
On your local development machine (since you mentioned local disk), you should have a file config/storage.yml that has a block similar to below:
local:
service: Disk
root: <%= Rails.root.join('storage') %>
In this example above, I'm storing the files in a folder named storage in the root of my rails application. Inside that folder you'll find nested folders that aren't meant to be navigated via file explorer/Finder (but you can).
Thru your rails app, via views for example, you'd use the url helpers which aren't well documented yet.
From a rails console, you can try, for a model named Foo, with a has_one_attached :photo
Foo.last.photo.blob.key
It should give you a ~24 character string.
The first 2 characters are a subfolder inside the folder I pointed you to above
The next 2 characters are a subfolder inside that
Inside the subfolder is a file with the name that matches the key you printed out above (no extension). That's your file.
If you have variants:
variant = #employee_staff
.avatar
.attachment
.variant(resize: '100x100')
.processed # If variant is not processed
variant.service.send(:path_for, variant.key) # Absolute path to variant file
ActiveStorage::Blob.service.path_for(#employee_staff.avatar.key)
As seen in this Answer

Set directory for xna StorageDevice on windows

I am using easystorage framework to save my game data on Xbox360 and Windows. It works fine, but on Windows it seems to be hardcoded to save data in MyDocuments. After looking sourcecode of easystorage framework, i have found that the problem is undelaying Microsoft class StorageDevice.
Implementation on Windows
User storage is in the My Documents folder of the user who is
currently logged in, in the SavedGames folder. A subfolder is created
for each game according to the titleName passed to the
BeginOpenContainer method. When no PlayerIndex is specified, content
is saved in the AllPlayers folder. When a PlayerIndex is specified,
the content is saved in the Player1, Player2, Player3, or Player4
folder, depending on which PlayerIndex was passed to
BeginShowSelector.
http://msdn.microsoft.com/en-us/library/bb200105.aspx
So my question is: Can i somehow reconfigure StorageDevice or StorageContainer classes on Windows so, that my saved data will be saved for example in %appdata%?

querying documents directory objects ios

I have images in uitableview, they each have a string for they're path in documents directory.
Now my trouble is if somebody adds the same image they will have the same path.
I was thinking of making an if-statement that will run on all of my fetchedResultsController objects or better yet my entire documents directory and append a number or something to the pathString.
lets say user adds title.jpg to doc directory, then he adds the same image then I want a check to see if it already exists, if it already exists in doc directory then append title(1).jpg so it can save properly and so on.
any efficient way of doing that ?
Depending on the OS you're targeting you can set the image name using NSUUID. If you're targeting < iOS 6 you'll have to use CFUUIDRef. This will always ensure you have a unique filename for an image.

Update File Name on Amazon S3 with IOS

I know there is no folder or directory concept on Amazon S3, but I want to update or delete a folder according to my app's users needs.
To Delete folder I guess I have to delete all the files one by one in a folder with:
- (S3DeleteObjectResponse *)deleteObjectWithKey:(NSString *)theKey withBucket:(NSString *)theBucket
http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AmazonS3Client.html#tasks
But there is no documentation to update a object name
Lets say my folder name is photos and there are two files in that folder image.png and image2.png that means I have
photos/
photos/image.png
photos/image2.png
I want to change folder name to photos1 that means I have to change image.png and image2.png to:
photos1/
photos1/image.png
photos1/image2.png
How can I accomplish this?
Is this the closest I can get? (copyObject)
Your thinking is correct. You can't rename a 'folder'. You must process each file individually by creating a copy with the desired name and deleting the original.
Also, be aware that according to the docs (http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectCOPY.html) the copy operation does not preserve the ACL, so if the moved files are public you need to explicitly mark the copies as public as well.
Related: How to rename a folder inside a bucket using the AmazonS3.net sdk

Resources