Is there any way to traverse through the image file that belongs to content asset folder?
For Instance:
https://loca.abc.com/contentassets/90a388f260a04f54b4056becc1c58307/lorem-ipsum-alternatives.png
If I have to locate this file in episerver media tab, how can i achieve this?
It is easy to locate files under global assets & site assets from "For all Site" & "For this site" container under Media tab but I cannot locate the files that are uploaded as part of content assets folder.
Any help is appreciated.
GUID in path (90a388f260a04f54b4056becc1c58307) means that this is (most probably) a "For this page" / "For this block" folder.
You can query database like this using that GUID:
SELECT pkID, ContentOwnerID FROM tblContent WHERE ContentGUID = '90a388f2-60a0-4f54-b405-6becc1c58307'
pkID will contain an ID of content folder, and ContentOwnerID will contain GUID of content (page or block) which is this folder belongs to, which you can use again to find owner content ID.
(you can also do the same in code using for example IContentLoader.Get<T>(Guid contentGuid))
Then you can use that ID to change edit URL and open that content inside edit UI, and then click "For This Page" / "For This Block" folder in Media tab.
Finally i was able to get to the path to contentassets in case anyone is facing the similar issue.
Navigating to
/EPiServer/CMS/admin/ManageContent.aspx?id=10574
where 10574is the content Id
Here is the episerver forum post that was helpful:
https://world.episerver.com/forum/developer-forum/CMS/Thread-Container/2019/2/how-to-delete-unreferenced-content-from-the-ui/
So the url needs to be
https://loca.abc.com/EPiServer/CMS/admin/ManageContent.aspx?id=10574
In summary, i had to build the above url.
1- https://loca.abc.com/ can be found using isitedefinitionresolver
2- define a const string /EPiServer/CMS/admin/ManageContent.aspx?id=
3- append contend id at the end.in this case 10574
This url will give you option to either edit/manage/delete/move the item to trash.
I am not entirely sure I understand what you need, but if you want to determine an assets' folder you could look into the ContentAssetHelper
Related
I want to get the UniqueId of my files in one drive. If you select a file and then download it, the download link contains the unique id. Additionally, if you share one of your word, powerpoint, excel and similar files with only specific people, the sharable link contains the uinque id but not for other files like photos and videos for which only the path of the file is seen in the link.
Is there anyway to get the unique id for photos and videos like it could be gotten for word and excel files? Is there any API that allows me to do so?
Thanks for answeiring.
Try this:
https://graph.microsoft.com/v1.0/me/drive/items/<Item ID>/children?$select=id,name
Result:
I have 3 files under a folder, so this is my request and result:
If you are not sure about your folder item id, use the request below to get all item id under root:
https://graph.microsoft.com/v1.0/me/drive/items/root/children?$select=id,name
Result:
More about this, see here.
Lets say I have Project A with an attached imageFile.
Then I created 10 different Projects which are underprojects of Project A.
I want to link the ImageFile of Project A to the Wiki of every underproject , so that I can see the ImageFile in the Wiki-Area of each underproject.
What im doing so far is to copy full path of the attached file of Project A in the Wiki of every underproject, like for example:
!>/attachments/download/157/schnittprofil.png!
Is there a better way to achieve that, because every time I update the imagefile, I have to renew the id-numbers of all imagefile-links in the underprojects.
Since an attachment is only actually identified by its ID and all attachments are immutable (i.e. can be changed after upload), new uploads will result in a new ID. Since multiple attachments with different IDs can have the same name, you can also not reliably find an attachment just by using its name in broad contexts.
That said, to solve your issue, you could use the include macro to include a common Wiki page in your sub-project's wiki pages which then displays the image attachment.
For that, you can create a Wiki page named e.g. Schnittprofil in your parent project where you directly upload your file. In the wiki page, just reference the image with
!schnittprofil.png!
Assuming the parent project has an identifier of project-a, you can then include the page in other wiki pages with
{{include(project-a:Schnittprofil)}}
Each time you change the page on the parent project, it will automatically also show the updated content on the child wikis. The only requirement is that the users need to be able to read the wiki of your parent project (e.g. are members of the project with the "Read wiki" permission).
I have created a custom datatype inside "Page Datafolders" on the "Data" perspective.
So, I have added this datafolder to a page and I am using it to show the data in the page with no problem...., but now I want to show this data sorted in admin console.
I tried to create a xml file inside of App_Data/Composite/TreeDefinitions without luck.
So, are there any tutorial to do this?
You are right to create a 'tree definition' xml file inside the ~/App_Data/Composite/TreeDefinitions folder, you should just ensure your definition has this bit:
<ElementStructure.AllowedAttachments ApplicationName="(your app name here)">
<DataType Type="Composite.Data.Types.IPage" Position="Bottom" />
</ElementStructure.AllowedAttachments>
Once you have this defined, you can attach it to a page using the 'Attach Application' command on it.
See http://docs.composite.net/Console/Guide-to-Applications/How-to-Attach-Console-Applications for details.
I have a fragment of html which is contained in a property of a templated EPiServer page, within that html there is an img tag which has a relative url in it.
When the page is viewed, I can see the src attribute of the tag has been altered to have the prefix /ProjectName/Templates/Pages/.
I understand that this is being done by HtmlRewriteToExternal so that image files that are stored alongside the aspx template (which does indeed live in Templates\Pages) are located correctly, however the image which is intended to be part of the html fragment is in my case actually stored under PageFiles/nnn/ (where nnn is actually the parent page's PageFolderID), and I need to somehow make the altered html reflect that.
I've created a class that inherits from FriendlyUrlRewriteProvider and registered my class. I can debug the application, and watch the requests go through the overridden methods, but I still can't see where the prefix is being added or get any idea how to change it. I can alter the src tag to a different relative path in my class, but the prefix is still being added.
I've read everything I can find on the EPiServer url rewriting, but can't find anything that hints as to where this prefix is being added or how to stop that or change it.
Things I've read:
http://blogs.interakting.co.uk/post/File-Extensions-and-URL-Rewriting-in-EPiServer.aspx
http://blog.fredrikhaglund.se/blog/2008/05/07/disable-episerver-urlrewriter-interference/ (this may contain the answer I'm looking for)
http://labs.kaliko.com/2010/11/prevent-episerver-urlrewrite.html
http://sourcecodebean.com/archives/episerver-friendly-urls-for-paginated-pages-and-why-the-asplinkbutton-must-die/510
http://tedgustaf.com/en/blog/2008/7/create-a-custom-url-rewrite-provider-for-episerver/
http://tedgustaf.com/en/blog/2011/4/publishing-plain-html-pages-in-episerver/
http://sdk.episerver.com/library/cms5/Developers%20Guide/Friendly%20URL.htm
http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_Web_UrlRewriteModule.htm
http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/
http://world.episerver.com/Blogs/Magnus-Strale/Dates/2011/3/Do-we-really-need-yet-another-HTML-parser/
http://world.episerver.com/Blogs/Yugeen-Klimenko/Dates/2011/6/How-EPiServer-URL-Rewriting-works/
http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=46869
I'm open to completely different solutions for what I'm actually trying to achieve, which is as follows:
I have multiple independent sets of static html files and related image / css / js files, which I'm trying to store / publish with EPiServer. The structure of each set looks something like
setfolder/
htmlfileA.html
htmlfileB.html
css/
styles.css
images/
piccy1.png
piccy2.png
js/
magic.js
I've figured that I should create an EPiServer page for the set, and then child pages for each html file, storing the html from the files in a property of the child pages. Currently I'm storing the related static files in the PageFiles of the relevant setfolder page, as that seems to be the most logically consistent place to put them.
It's hard to give the best solution without seeing it all infront of you. But one easy way is to alter the HTML-code when you print the property to the page.
Like <%= ChangeRelativeLinks(CurrentPage["HtmlCode"] as string) %>
And in the ChangeRelativeLinks(string htmlCode) you do a regexp or similar that changes relative links and images to the pagedir as an absolute path.
If you are storing the images in PageFiles which is a Virtual Path Provider you should be able to get the url to your file simply by using the API. On the PageData class (ie CurrentPage in your template) you have a method called GetPageDirectory() which gets the page folder.
You can read more about VPP concepts here:
http://sdk.episerver.com/library/cms6.1/Developers%20Guide/Core%20Features/File%20System/File%20System%20and%20VPPs.htm
No need for a url rewrite provider for this I think.
What function in Drupal gets file attachment path?
Edit: the attachments provided by Upload module in system section. But since you mentioned there may be another way around it. Maybe I could achieve may goals using FileField module so if you could tell me how to get a direct link of a file uploaded by FileField module that may also be very helpful.
Edit 2:
Ok I will start from my main and final objective:
It is to get an image linking to a file which visibility I could be managed using CCK module.
I am doing this step by step. So now I have written a code which generates the needed image and I have added that image to one of content types teaser. I found a way to warp my image in a tag and I had dug up simple attachments url. So my next step is to advance from simple upload attachment to the one added by FileFields and from odd looking HTML pace in all PHP document into beautifully managed CCK field.
How to fetch file path of a file uploaded FileFields?
Some plain and at the same time rich tutorials for making custom fields for CCK module.
Assuming you know how to get the $node object for a node containing a file attachment, this is super easy:
Upload (core)
$file = upload_load($node);
echo $file[1]->filepath;
Where 1 is the index of the file. Upload can let you upload more than one file, so file 2 would have an index of 2 and so on. If there's only one file, it'll always be 1.
More info: upload_load() API reference.
FileField
echo $node->field_fieldname[0]['filepath'];
Where field_filename is the short name you've used for the field, and 0 is the index of the field. CCK fields let you have multiple values in one field, so 0 would be the first, 1 would be the second, etc. If you only have one value, it'll always be 0.
Note: if you want to get the rendered output of the FileField using its formatters, you can just use $field_fieldname in your node template, or if you want to store the rendered output, you can use:
echo content_format('field_fieldname', $node->field_fieldname[0]);
More info: content_format() API reference.
Upload is a sad little module, and has been completely replaced with a core implementation of FileField in Drupal 7. If you have the option to use FileField, you should.
Don't direct links of file attachments appear below the uploaded file for the core Upload module?
Since you are trying to use images, you should use http://drupal.org/project/imagefield CCK module in order to add images to specified content type. After that using the Display fields tab in Content type configuration you can specify how image would be presented (as a link, image, image with link to node...) both in teaser and body view.