When I searialize my canvas, I'd like to have my images sources as relative path instead of absolutes
Is there anything I can do for that ?
Thanks !
Related
I created the folder and uploaded 3 jpg images. And putting the right path in Image Folder. But it still not show the images on page.
What am I doing wrong?
This looks correct to me.
I suggest trying an alternative path for the Image Folder such as:
/images/Manifestation_Miracle
I also suggest renaming the folder to remove the underscore to see if that helps.
Not sure how else to specify the path to the image.
I've added a png into a new image named "StatusBarIcon", which lives inside "Images.xcassets" resource folder.
I see they put a json file and what not.
Tried to do what the examples out there say, but no matter what I try, I always get nil as the output of [NSImage imageNamed:#"name of paths attempted here"]
Won't load using the full path either, I suppose the method is looking for the name of the image, but I've no idea how to specify the name correctly it seems, or perhaps I need another method?
Here are screenshots of my code, and my project.
Make sure you have the project set to use xcassets instead of just individual resource files. Once you create an image in the xcasset, you should just specify the name of the image, not the path. For example, [NSImage imageNamed:#"StatusBarIcon"]
To load from the assets catalog of the current bundle, use something like:
let image = Bundle(for: type(of: self)).image(forResource: NSImage.Name(“logo"))!
Our current image folder structure consists of the same image at different sizes for use within our website
Content/thumb/5316.jpg
Content/ShotView/5316.jpg
Content/miniview/5316.jpg
Content/Full/5316.jpg
Is it possible to have imageresizer handle/rewrite the requests to the smaller size images as calls to the Full image with default height/width parameters depending on the folder selected can I do this via a combination of IIS virtual directories and default settings?
So we could retain our existing structure but as products change we would only need the 1 original image?
All you would need is some URL rewriting; no need for Virtual Directories.
The Config.Current.Pipeline.Rewrite even will let you parse and edit the path and querystring in code, which is the most flexible solution.
IIS URL Rewrite, however, is also capable of solving your problem.
I am new to programming, so I am confused. I know that relative path is a way to specify the location of a directory relative to another directory.
But I don't understand why do I need relative path. Could you please give me an example?
why do I need relative path
So that when you ship your code, you don't have to worry about where the user will put that code, while using a path to some resource.
You can use a path relative to the project root, which will be same regardless of where the project is.
Absolute path is the full directory path .
Relative path is relative to the directory you are in, so if you are in the above directory, then if you reference file test.txt as relative, it assumes the same directory you are in. When you do ../ then it goes back one directory.
Suppose you are in a directory whose path is k... In this directory there is a file named a.txt. Now
the absolute path is C:\A\B\a.txt
the relative path is a.txt (as you are in the same directory).
Why you need a relative path
You need a relative path so that in your code you can use any file without depending on the path set by user. For example in your code you need to access a file. If you use absolute path then the path will change depending on the location where the user will set it.
But if you use relative path then the path will be always same as it will always be in your project folder. (or a fixed hiararchy)
Great question. I've noticed relative paths are extremely helpful when dealing with larger sites that have a test or staging area, then the actual live site.
For example, say you have TEST.MYSITE.COM which in turn gets pushed out to WWW.MYSITE.COM. In this example, relative links do not need to be updated because you test the file, the push live when it meets your expectations.
Lets say you have an html file that references TEST.MYSITE.COM/MYFOLDER/MYIMAGE.JPG and you would like to update this image. After the image has been corrected, if you are not using relative links, you would then need to change the image name on the html file from "TEST.MYSITE.COM/MYFOLDER/MYIMAGE.JPG" to "WWW.MYSITE.COM/MYFOLDER/MYIMAGE.JPG".
If one was using the relative link "/MYFOLDER/MYIMAGE.JPG" this would not need to get updated. You could only imagine how this example would get multiplied throughout the site, which would then become a tedious process.
Relative links help avoid this. Hopefully this makes some sense. It sounds like you know what they are, this was just attempting to answer "why do I need relative path[s]".
I need some help for my OS X program.
I need the URL of a file inside the supporting files.
I have an array in which I save URLs from images and add them to a table view and if no images are chosen I want to add a question mark image (it is called "bild.jpg")
This bild.jpg is inside the supporting files but for later use I can't just save the name of the image because the array stores also URLs.
I need to have the URL of that image in the supporting file because it's easier to use the array for image initialization.
Is there a function to get the path or is there a standard path to the supporting files? I already search on the net but couldn't find anything that could help.
You seem to be talking about the application bundle and its resources directory rather than, say, a subdirectory in ~/Library/Application Support/..., in which case you probably want something like:
[[NSBundle mainBundle] URLForResource:#"bild" withExtension:#"jpg"]
(See the documentation for NSBundle.)