Where do I put picture in my ASP.Net MVC2 application? - asp.net-mvc-2

Where do I place images within my solution?

I usually create Images folder inside Content folder. Most 3rd party components that use .css files search images subdirectory for their images by default.

You could put them in the Content folder, along with your .css files. Or you could create a brand new folder and organize it any way you like.

In the content folder.

We have a separate resources domain that serves up all static content (recommended). In the solution, I just have a 'resources' folder that mimics the structure of the production folder. Easier to deploy using a script. You can create a separate site or vdir on your local web server and map it to this static folder. The location could then be refernced in your project via an app setting (configuration.resourcedomain + "/resources/images/xyz.jpg")

Related

Kentico - Can a media library be used as a Form files folder?

I have a form with an Upload file field on a Kentico 9 website. Form files are currently stored in the default folder (BizFormFiles). I would like to store those files in a place where I can easily manage and delete them on the CMS. Would it be possible to store them automatically in a media library folder?
Thanks!
No, as far as I'm aware. It can't be configured this way. The only way to make this manageable via CMS interface is to develop a custom module with a custom interface.
I have created a new media library in my instance and then I have used that folder path as the custom form files folder in the Settings.
The form files are then placed inside this library folder in a subfolder. And then, I can also see the file in the Media library UI - just with the yellow exclamation mark that the files was not "imported" into the Kentico DB.
The only downside I see here is multi-site environment. While the media library is assigned to a particular site, the form files from all sites will be stored in that media library folder.

Hugo deploy and delete not necessary files

I'm developing a new Hugo site and in this case I thought to create also a template so.I can use for future site.
Well in the template there are tons of vendor files and library because depending of the pages that the site will implement these library will be used. The problem is on the deploy. For example I use Line icons library that has a lot of .png files. (For example 200 files).
Well in the template I put all the files but could happen that in the site that implement this template I use only five icons. Is there a way that look around the final HTML and the usage of the icons and delete in the public folder the not necessary files?
Not directly.
You would need to add an utility script to your template, in order for any user implementing said template to be able to call this script on demand.
That script should then be able to:
analyze the HTML files generated in public_html
cleanup the icons accordingly

Not able to access image on jsp file

Attaches is the image of my project hierarchy. I am trying to call image from images directory to the jsp file in jsp directory but I am getting blank screen.
So far I have tried :
/WEB-INF/images/'<'imageFileName'>'
/images/'<'imageFileName'>'
/'<'imageFileName'>'
src/main/webapp/WEB-INF/images/'<'imageFileName'>'
Please help me on this.
You can't access any resources that are under WEB-INF folder, it serves just that purpose, to hold the resources that are not directly visible for the public but available to the classloader (servlets) of your web app.
You should make a mapping by the means of mvc:resources element, you should checkout the docs
for your particular case a mapping like
<mvc:resources mapping="/images/**" location="/WEB-INF/images"/>
should work out, and you'll be able to browse your images via request such as
/images/'<'imageFileName'>'
You can place your images and jsp folder under the web-app folder rather than WEB-INF folder. Then you can access the images using:
/images/'<'imageFileName'>'
The JSPs cannot access files inside WEB-INF folder directly, since it's not publicly available. But you can access it indirectly through a Servlet which will return the Image's stream object.
The sample code to access files in WEB-INF folder is in the below link. Have a look.
http://simple.souther.us/ar01s10.html

serving using zinc and pharo

After working on zincs tutorial I want to serve an entire repo filled with .js, .html and .css files I created a firstpathsegment so that I upload all files to the sam place but then how to create a place to serve and store the files ? and how to upload them ?
If you read on in the tutorial, you'll find how to do that in the part 'Static file server'
(ZnServer startDefaultOn: 1701)
delegate: (ZnStaticFileServerDelegate new
directory: (FileDirectory on: '/var/www');
prefixFromString: 'static-files';
yourself).
If you compare that to the ZnMonticelloServerDelegate implementation, you'll see how to write files. If you want to be able to create subdirectories, take a look at FileSystem-Core-Public. In a public-facing site, you'll need to do something about authentication and access control. We mostly put an apache or nginx in front (and let that take care of the static files).

How can we make a nested directory in resource folder to put the xmls with same name?

How can we make a nested directory in resource folder to put the xmls with same name for different folders.And how we can read it using path in iphone app programatically?
Actually i want to make like resource>a>b>some.xml
again in resource like resource>f>g>some.xml
and so on...how ever both xml is containing different data in it.and also tell me the way how we can read it in iphone application.
You cannot use the same filename, even if they resides in different folders.
Instead, as a workaround, you can name the files like:
a_b_some.xml
f_g_some.xml
you can create a folder structure on your system and then directly add the folder to your XCode Project under resources by drag-drop.
this folder must display in BLUE color (physical grouping in folder on disk) rather than YELLOW (logical grouping in project only) just like native folders on mac. like this you can put same file in different folder hierarchy without any problems.
you need to create a absolute path to your file whenever you want its access your file [NSBundle pathForResource:] will not work in this case as it does not have access to your custom folder hierarchy.
best of luck.