I've an WebSite written in Asp.Net.
I wish to add a image on the login page (a cshtml file).
I tried this :
<img src="#Url.Content("~/Content/logo.png")" alt="Answer logo" />
But it doesn't works, the image is not displayed.
Is there specific settings to add on the "Content" folder or on the "logo.png" file ?
My project structure :
Project
|
|- Content
|- logo.png
|- View
|- Auth
|- LogIn.cshtml
Related
when I attempt to view images in drupal 8 I am not able to see in any style , image style folder has been created however images are not saving in this folder I set permission 777 clear cache many time but did not work
"image style folder has been created" . You need to create the style first,(Configuration-> media -> image style) and then associate it with your custom image field in "manage display" (structure -> content type -> 'yourcontenttype' -> manage display).
PS: if you are invoking your image directly through the twig template, must add some code, like this:
<img src={{ 'myimage.jpg' | image_style('image_style_machine_name') }}
I know the solution for this problem
The solution is to use "get_template_directory_uri()"
But Can someone please tell me why this relative path itself "/img/entry.png" is not working even though I'm using parent theme(Not child theme)
Before(Not working)
<img src="img/entry.png" alt="">
After(Working) → Why??
<img src="<?php echo get_template_directory_uri()?>/img/entry.png" alt="">
I putted index.php and Img folder at the same level in Theme folder as below.
So why "img/entry.png" is not working?
(Theme folder)
|
|--index.php
|--img
|-entry.png
get_template_directory_uri() adds the path of the directory in which img/is located. If you want not to add that function then you have to add the path manually.
For example if your WordPress instance uses a theme called my-theme then this /wp-content/themes/my-theme/img/my-image.jpg could be served to img's src.
the root of wordpress project is consisted od some directories such as 'wp-content' and 'wp-admin' and doesn't contain any folder named 'img'.
the 'src' attribute of images in HTML tag targets the root of the project then reads the url. so you should set your img folder path correctly from the project root.
My initial menu for my blogdown site is taken directly from the blogdown book.
[[menu.main]]
name = "Home"
url = "/"
weight = 1
[[menu.main]]
name = "About"
url = "/about/"
weight = 2
[[menu.main]]
name = "GitHub"
url = "https://github.com/rstudio/blogdown"
weight = 3
[[menu.main]]
name = "CV"
url = "/vitae/"
weight = 4
[[menu.main]]
name = "Twitter"
url = "https://twitter.com/rstudio"
weight = 5
The index of my site automatically populates with any posts I add via Addins > New Post. If I alter my index.Rmd file in my main project directory (shown below) no changes occur on my front landing 'homepage'.
├── archetypes/
├── content/
├── data/
├── layouts/
├── public/
├── ...
├── config.toml
├── index.Rmd
└── my-website.Rproj
My index.Rmd file looks like this, although my website won't publish my intended paragraph on my main 'homepage'.
---
site: blogdown:::blogdown_site
---
# Intended first paragraph
Hi. Thank you for visiting my website... more words... etc
To further complicate matters, there is no _index.md file in my content/ directory. Could this be the issue? I'd like to post some introductory paragraphs before all my posts appear on the main page (homepage) of my blogdown website.
Yes, you need to create _index.md under content/. Then the content of _index.md will be displayed on your homepage.
There was a minor issue with the hugo-lithium theme, which I just fixed on Github. In the old version, if _index.md is not empty, the list of posts will not be displayed. Now both the content and the list of posts will be displayed. If that is not what you want, you can certainly revert my change in layouts/_default/list.html.
I have a custom WordPress theme installed and my images are referenced as such:
index.php:
<img src="images/newlogo.png" height="110px" width="400px"/>
My images folder is relative to my index.php from which I have included the above code.
My images are not showing when I render the webpage in a browser, it is showing the default image not found thumb instead.
Image filepath:
wp-content/themes/my-theme/images/newlogo.png
Homepage (index.php) filepath:
wp-content/themes/my-theme/index.php
Your index.php is a template that will be loaded by WordPress's main entry point (at /index.php) and the code behind it; as such its URL won't be ...wp-content/themes/my-theme/index.php. You should use the WordPress method get_stylesheet_directory_uri() to find your theme's directory from any of your theme template files.
For example:
<img src="<?php echo get_stylesheet_directory_uri() ?>/images/newlogo.png" height="110px" width="400px"/>
Basically, any relative paths to images from a web page are considered as relative to that web page's URL. However, with WordPress templates, you can't know for sure what the actual URL will be -- your index.php template might (probably will) be used for many different pages on your site, at many different URLs. It could be used at the top level for a page at /about, and also for an entry at /blog/2014/01/05/typical-blog-post, for example.
WordPress handles both building the URLs and loading your template file into them appropriately. But this means that you can't depend on the URL of the template you're writing being a constant. Instead, WordPress provides a series of functions, like get_stylesheet_directory_uri(), to let you grab and output the correct URI to your stylesheet files as necessary.
I install wordpress in my pc.
the path of thr theme are C:\Program Files\Zend\Apache2\htdocs\www\www1\wordpress\Building_Child_Themes\wp-content\themes\BLANK-Theme\home.php
inside the folder BLANK-Theme there are folder cald images like wordpress\Building_Child_Themes\wp-content\themes\BLANK-Theme\images
inside the file home.php I have line <img src="/images/prod-sprunkler.png" alt="Image of Super Sprocket 1000" />
I can not sucsses to view the mage when the home.php are upload, in the adress bar I see http://127.0.0.1/www/www1/wordpress/Building_Child_Themes/
what I miss here ?
Thanks alot.
You have to use full path. You can take help of default functions to get the full path.
If the style.css file of your wordpress site is in the same directory, you can use the following.
<img src="<?php get_stylesheet_directory() ?>/images/prod-sprunkler.png" alt="Image of Super Sprocket 1000" />