I have a small question. I am using prestashop, and would like to add image in my footer. I am trying to add img tag in footer.tpl
<img src="/htdocs/themes/warehouse/img/logo_btm.png" alt="logo" />
but instead of picture i have question mark.
you use relative path
instead of relative path use full url to your image like
http://domain.com/link/to/image.jpg
You have to use smarty global var, put the image in your theme's image folder and use this syntax
<img src="{$img_dir}logo_btm.png" alt="logo" />
Related
I am retrieving text which contains images saved in WYSIWYG editor(Summernote). Is there a way to replace src attribute value in img tags using asset()?
Example:
<img src="images/image.jpg"/>...
To:
<img src="https://.../images.jpg"/>
I want solution which would cover all bases: spaces in image name, different extensions...
Sure, just use the curly brace syntax in your blade to render the asset()
<img src="{{ asset('whatever_you_want') }}"/>
I don't think you can do it in Blade. You could, in your model, add a function that replaces all images to full paths. This could be done through a regex pattern that looks for URLs in tags.
I would, however, make sure the full path to the image is included in the text in the database. This way, you always have access to the right path to the image, and you're not relying on a piece of code to display the right image.
If an URL to a image is set in a HTML template, then the URL is updated to reference files inside the theme folder. For example,
<img src="image.png" />
is replaced by:
<img src="http://localhost:8080/mysite/++theme++mytheme-theme/image.png" />
However, if I write following Diazo rule:
<replace css:content="#some-class">
<div id="#some-class"><img src="image.png" /></div>
</replace>
the URL of the image is not update. How can I write Diazo rules where the image gets correctly referred. I want to refer this image in the template HTML file with <img src="path/image.png">. However it is not clear what to put instead of path. I notice that path cannot be an absolute path because it depends of the site domain. Also, it cannot be a relative path because it depends on the path of each page in the site. May be it would be useful to have an specific keyword to reference the theme folder. For example, <img src="$themeFolder/image.png">. Exists such keyword?
You may create XSLT parameters in your theme's manifest.cfg file. Just add a stanza like:
[theme:parameters]
theme_base_url = string:${portal_state/portal_url}/++theme++mytheme-theme/
Then you may use it in your rules file:
<replace css:content="#some-class">
<div id="#some-class">
<img><xsl:attribute name="src"><xsl:value-of select='$theme_base_url' />image.png</xsl:attribute></img>
</div>
</replace>
In my twig template I have
<img scr="{{ asset('bundles/jbamain/images/kanren1.png') }}" />
At runtime it becomes
<img scr="/jba/php/web/bundles/jbamain/images/kanren1.png" />
If I browse to
http://localhost/jba/php/web/bundles/jbamain/images/kanren1.png
then, the image is returned as expected.
However, the page, which has the tag doesn't show the image. I set image file permission to 664. Also I set image width and height in css, but still the same. What may cause this issue?
You have error in image attribute src. So change scr -> src
I tried to add a linked image to a wiki page without luck. The HTML syntax for the linked image is below:
<img width="300" height="220" alt="Virtual Tour" src="Path to Image" title="Virtual Tour" class="alignleft size-full wp-image-8517">
What's the right syntax for linked image in MediaWiki?
I am using [[File:Fielname.jpg|frame|||||link=External Link|alt=ALT|Caption]]
But I need to add CSS class to both A and IMG tag and it seems I cannot.
Thank you.
Create a template once Template:MyReusedImage with your image in right size, title etc.
Then reuse the template on the pages {{MyReusedImage}}
I have this image in my header template <img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
When the template is used from a gsp file inside the 'main' directory, the image is loaded. Although, if I have the same template being used inside a gsp file inside a controller, the image is not loaded. I have tried to change this:
<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
to this:
<img src="../images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
and it works, but now the image in the other page don't. Any idea to solve the problem? I know the key must be absolute path. But i've done some searches and found nothing.
You can put your images in resource folder (for example, in YOUR_PROJECT/web-app/images) then access it in gsp by resource tag. By this way you won't have the absolute path problem.
For a concrete example, you can refer this question.
Try "${application.contextPath}/images/slide-1.jpg". It's a semi-absolute path that will work in any of your deployment environments.