I am calling socialmedia.php from every page on my website to display a little "Social Media" div where people can visit my social media pages.
I am calling this using <?php include './socialmedia.php' ?> or <?php include './socialmedia.php' ?> depending on what directory I am in.
In my socialmedia.php file I have the following code.
<a href="http://twitter.com/kinghenryharris" target="_blank">
<img class="socialMedia" src="../images/twitter_logo.png" alt="Twitter" width="40px" height="40px"></br>
</a>
<a href="http://facebook.com/kinghenryharris" target="_blank">
<img class="socialMedia" src="../images/facebook_logo.png" alt="Facebook" width="40px" height="40px"></br>
</a>
<a href="http://youtube.com/mrgorillalogic" target="_blank">
<img class="socialMedia" src="../images/youtube_logo.png" alt="Youtube" width="40px" height="40px"></br>
</a>
Is it bad practice if I am in the home directory to do ../images/youtube_logo.png
When calling it from www.example.com/page.php does it matter that I am going up two directories with ../images/youtube_logo.png`
It seems to work but I am wondering if this is wrong or I should change it so if I am in the home directory do ./images/youtube_logo.png or should I just leave it the same?
-Henry
Related
I have one template & i used base_url() to load the logo. In source the path can be accessible but the logo is not loading into the webpage ?
<a href="index.html" class="logo">
<img src="<?php echo base_url('assets/frontend/img/logos/logo.png'); ?>" alt="logo">
</a>
When i use without logo class its working
<img src="<?php echo base_url('assets/frontend/img/logos/logo.png'); ?>" alt="logo">
How i can load the logo within logo class ?
website: www.e-veloce.com
I don't see logo.
I tried to change src in header.tpl to
<a href="{$base_dir}" title="{$shop_name|escape:'html':'UTF-8'}">
<img class="logo img-responsive" src="https://www.e-veloce.com/presta/img/logo.jpg" alt="{$shop_name|escape:'html':'UTF-8'}"{if $logo_image_width} width="{$logo_image_width}"{/if}{if $logo_image_height} height="{$logo_image_height}"{/if}/>
</a>
after that, I don't see logo
logo.jpg file is in presta/img/logo.jpg - so it looks good
Any ideas ?
It happens after I made SSL certification.
You have indicated an incorrect path, simply delete /presta/. Based on your code, this should work:
<a href="{$base_dir}" title="{$shop_name|escape:'html':'UTF-8'}">
<img class="logo img-responsive" src="https://www.e-veloce.com/img/logo.jpg" alt="{$shop_name|escape:'html':'UTF-8'}"{if $logo_image_width} width="{$logo_image_width}"{/if}{if $logo_image_height} height="{$logo_image_height}"{/if}/>
</a>
Use this:
src="{$base_dir_ssl}img/logo.jpg"; // https://www.e-veloce.com/img/logo.jpg
src="{$base_dir_ssl}presta/img/logo.jpg"; // https://www.e-veloce.com/presta/img/logo.jpg
I found solution. You need to do:
<img class="logo img-responsive" src="img/logo.jpg" alt="Veloce - Chemia od nas, dla Ciebie" width="367" height="54">
so i cut src with https:// only to img/logo.jpg.
Problem is popular, I hope that solution will help someone in future
I started to learn Wordpress and I'm making my own theme. Within the design I have some images that are supposed to show up... but they don't.
I was using this code:
<div class="col-xs-4">
<img src="images/html_brand.jpg" class="img-responsive">
</div>
and then I found I should use php to link to my image:
<div class="col-xs-4">
<a href="#">
<img src="<?php bloginfo('stylesheet_directory'); ?>html_brand.jpg"
class="img-responsive">
</a>
</div>
But the problem is, the image still doesn't get displayed. And yes I did upload them to my web server. I have them in the directory of my theme: mythemename/images/html_brand.jpg
If you use bloginfo() to output your theme path, you need to add another /, followed by the remaining path to your image. Based on where you've placed your image, this should work:
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/html_brand.jpg" class="img-responsive">
However, bloginfo() ultimately relies on get_template_directory_uri() to work, so you might as well just use that:
<img src="<?php echo get_template_directory_uri(); ?>/images/html_brand.jpg" class="img-responsive">
Slight Correction:
bloginfo() with the specific argument of stylesheet_directory actually relies on get_stylesheet_directory_uri() to function -- get_template_directory_uri() like I originally said.
https://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/general-template.php#L439
I am doing a photo gallery with php, and my main page is a gallery with all thumbnail images. If you click on any thumbnail, it will link to another page with the original size image (like google images does). I do that with an hyperlink that contains an image inside :
<a href='".$row['image']."' class='image' title='".$row['title']."'>"."<img src=".$row['thumb']." class='thumb'/> </a>
Then if the user is now in the redirected page showing the big image selected, how can I do it so that if the user clicks on top of the big size image then it will be redirected to the main page with all the thumbnails?
<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
<img src="<?php echo ['thumb'];?>" class='thumb'/>
</a>
If you are able to link to a detail page using <a href, why are you not able to do the same from the detail page?
considering you are on listing page, say listing.php and images are listed from database. You can loop through the images as given below.
<a href="detail-image.php?id=<?php echo $image_from_database['id'];?>" class='image' title="image title">
<img src="<?php echo $image_from_database['thumb'];?>" class='large'/>
</a>
So, on clicking you will be redirected to detail-image.php where you can get the id using PHP $_GET/$_REQUEST
and then fetch the big image from database and show it. There you can do same to link to the listing page
<a href="listing.php" class='image' title="image title">
<img src="<?php echo $image_from_database['large_image'];?>" class='thumb'/>
</a>
Look I don't know exactly what's the problem,
but I think there wrong in your code,
must be like it,
<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
<img src="<?php echo ['thumb'];?>" class='thumb'/>
</a>
!! The page must be "Something.php"
I have a site done in PHP using SMarty templates (that I didn't create). The following code is used in the view_video.tpl to generate a button with a function attached to the onclick action.
<div class="user-button" id="user-button-up">
<a href="javascript:void();" onclick="video_description_toggle()">
<img height="16" width="16" src="images/user-arrow.jpg">
</a>
</div>
<div class="user-button" id="user-button-down" style="display:none;">
<a href="javascript:void();" onclick="video_description_toggle()">
<img height="16" width="16" src="images/user-arrow-down.jpg">
</a>
</div>
I noticed these buttons were not showing up on the page, so I ran the page through Pingdom (tools.pingdom.com) which breaks down each element of a page and how long it took to load etc. On the page results, the two images (user-arrow.jpg and user-arrow-down.jpg) show a file path of: sitename.com/video/41137/images/
None of the other images have this incorrect file path, just these two.
When I view the source of the page from a browser it shows:
<div class="user-button" id="user-button-up">
<a href="javascript:void();" onclick="video_description_toggle()">
<img height="16" width="16" src="images/user-arrow.jpg">
</a>
</div>
<div class="user-button" id="user-button-down" style="display:none;">
<a href="javascript:void();" onclick="video_description_toggle()">
<img height="16" width="16" src="images/user-arrow-down.jpg">
</a>
</div>
In the video/ directory there are only videos, no folders with numbers (or with image directories in them)... I'm sure this should be easy for anyone with PHP experience using templates (that's just not me... yet).
Thank you.
The path in img is relative to the url shown, not where the template is stored, so if you're in sitename.com/video/41137/ it will look for the images folder here, unless you add a slash or "../../" before "images"