replacing image in twig/symfony template: not working properly - symfony

So I want to replace the company logo. These are what i tried:
copy new image to the images folder and change the img tag to reference to the new logo.
make the new logo filename same as the old filename. delete the old logo and put the new one in it's place
my problem is that when I change tried the 2 things above, the new logo is displayed like it's been zoomed in. It's weird since the width and height parameters are used in the img tag.
Any ideas what I could be doing wrong?
Some info:
This is the html inside in the twig that references the company logo. This is the one before I started my edits.
<div class="navbar-header">
<a class="navbar-brand" href="http://www.mycompany.com" title="Buy from us" rel="home" target="_blank">{% image "#AppBundle/Resources/public/images/our-company-logo.png" %}<img src="{{ asset_url }}" width="214" height="45" alt="Flinders logo">{% endimage %}</a>
</div>
notes:
I'm running symfony in dev mode
I cleared my symfony cache
I dumped my assets (php app/console assetic:dump) just in case it makes a difference.

why not use it as a background image inside the nav-brand css class and with property of background-position cover or something like that?

Related

Set background image in asp.net core mvc

I have created a folder inside wwwroot, called Media. I'm trying to set a background image with css like this:
<body style='background-image: url("~/Media/background.png")'>
But the background does not appear.
However, if I try to put is as a image it works:
<img src="~/Media/background.png" />
So, how do I handle background images?
Try the following:
<body style="background-image: url(../Media/background.png)">
Maybe: try to use url of image instead of relative path.
In That case I suppose `https://yourdomain/media/background.png' could do the trick.

Wordpress: I can't change the logo image of my site

First of all: I've already looked on How to change the logo of my wordpress site and I didn't found any useful information for my problem.
In the picture you see the costume logo picture...
...and I change it, if the screen size gets smaller, with this new image:
To replace the image I must write
#media screen and (max-width: 800px){
.logo-wrapper > .logo > img {
background-image: url('wp-content/uploads/2017/06/new_logo.png')!important;
}
}
But the old logo is still seen in the homepage and covered with a part of the new logo:
The old logo is probably still seen because it comes from the IMG-tag. Which will have a 'src="path-to-image"'
In your CSS, you're setting the background of the IMG-tag to 'new_logo.png' but the IMG might still hold an image as well.
Honestly, I'm not familiar with WP code structure, but you should look at the code where the IMG-tag resides or is generated. That's where you'll have to make some modifications to change the way the default logo is displayed to also be a CSS background so that your media-query would work/override default upon resolution change.
It could be something like this:
<div class="logo-wrapper">
<a class="logo" href="<?php someCodeToGetUrl()">
<img src="<?php getLogoUrl(); ?>" />
</a>
</div>
A potential change could be:
<div class="logo-wrapper">
<a class="logo" href="<?php someCodeToGetUrl()">
<span style="background-image: url('<?php getLogoUrl(); ?>')"></span>
</a>
</div>
At which point your media query should work. It may require some additional CSS for sizing/positioning etc.
Hope this helps. I'm sorry that I couldn't be of more help. I don't have enough time to install WP and check out the code for a more accurate example.
Try checking for logo option in "Customize" section on top of admin bar.
Check header.php file for logo tag and change URL of that.

wordpress website displaing image and image path

Recently I noticed in my Wordpress website that in all the pages, when I have an image to display, it displays the image and right after it displays the path to the image, including the image properties. The entire
Can someone helpe, please?
enter image description here
Seems like your HTML Structure breaks with your PHP Code. you need to check your code where you getting this Image. This is how its showing from Inspect Element:
<img src="http://antiparosbeauty.gr/wp-content/uploads/2014/03/weding.jpg" alt="weding" class="alignleft size-full wp-image-140" srcset="http://antiparosbeauty.gr/wp-content/uploads/2014/03/weding.jpg 345w, <a href=" http:="" antiparosbeauty.gr="" wp-content="" uploads="" 2014="" 03="" weding-300x141.jpg"="" target="_blank" height="163" width="345">

How can I print image field inside <img src=""> inside my custom views-view-fields.tpl.php

I have a view for news content type
I overrige the view's template grid style output
In Row style output:views-view-fields.tpl.php overriding every thing seems ok except image field!
I print tilte and description and every other thing using print
`$fields['fieldname']->content;
but print $fields['field_teamimage']->content; " class="img-respo" alt="team img 1">
displaying nothing!
How can I print image field inside Only local images are allowed. inside my custom views-view-fields.tpl.php
I spent all my day trying and searching without a result
Thanks
For this you need to override filed template file Field Content: Images of property (ID: field_teamimage) and after that you can add img src there, something like
<img class="img-responsive" alt="team img 1" src="<?php print file_create_url($row->_field_data['nid']['entity']->field_teamimage['und'][0]['uri']); ?>"/>
You can even add image src directly in src.

html image path incorrect

I'm somewhat perplexed by this.
..
The page im working on is located in
www.gd-gaming.com/wordpress/
However, for the background image to show, instead of putting it in
www.gd-gaming.com/wordpress/images
I've had to put it in
www.gd-gaming.com/images
Now, When I visit an additional page from the one im working on, (www.gd-gaming.com/wordpress/breakout-canidates/)
That background image dissapears. I cant understand why, I use the same code on a vbulletin website and the background displays everywhere. If I firebug it, it tells me the image didnt load, meaning the path is incorrect. I'm not sure where to put it though.
For actual reference..
http://www.gd-gaming.com/wordpress
http://www.gd-gaming.com/wordpress/breakout-canidates/
Code: <div id="background">
<img class="background" src="images/bgmain.jpg">
</div>
use absolute:
<div id="background"> <img class="background" src="/images/bgmain.jpg"> </div>
instead of relative one

Resources