I have this code in my php dynamic table
<?php echo'<img src="../images/a-camera-icon.png">'.$row_rsInventory['PHOTO'].''; ?>
When the code runs it displays the link as an image and the text as a hyperlink in the PHOTO field. What do I need to change so that it just shows the link as an image in the PHOTO field. I appreciate any help on this.
Just remove the text you have for anchor .$row_rsInventory['PHOTO']. this way
<?php echo'<a href="http://'.$row_rsInventory['PHOTO'].'">
<img src="../images/a-camera-icon.png">
</a>'; ?>
Remove the anchor text .$row_rsInventory['PHOTO'] Use either of the code below
<img src="../images/a-camera-icon.png">
<?php echo'<img src="../images/a-camera-icon.png">'; ?>
Related
I have below code but don't want to encode the image as Base64 just link the image and get it with same function.
<img src="data:image/png;base64,'.base64_encode(file_get_contents(get_field('email_logo', 'option')['url'])).'" alt="The Domain" />
How to call the function inside img src?
You've not shown us how this bit of code connects to the PHP around it. Assuming that there is a closed PHP block before hand, rather than this appearing in a print or heredoc...
?>
...
<img src="data:image/png;base64,
<?php
print base64_encode(file_get_contents(
get_field('email_logo', 'option')['url']
));
?>'" alt="The Domain" />
If you want only the link and it's correct as it is:
<img src="'.get_field('email_logo', 'option')['url'].'"/>
I'm using Advanced Custom Fields plugin for custom fields in WordPress, and I tried to embed YouTube videos by adding one more custom fields where I write the YouTube video IDs. And I added the snippet below to the realted content php file, but it did not work. Could you please tell me what is wrong with the code? Thanks.
<div class="videoembed">
<?php $embedcode = the_field('video-embed');
echo do_shortcode("[embedyt]http://www.youtube.com/watch?v=" .$embedcode. "&width=600height=350[/embedyt]"); ?>
</div>
I had the problem myself and found a solution that worked!
the field type must not be oembed, but must be single-line text
and than it works with this code:
<?php // use inside loop echo $youtubevideo_code = wp_oembed_get( get_field('video_url') ); ?>
You don't need to use shortcode in your case, just write iframe tag :
<iframe src="<?php echo $embedcode; ?>" width="600" height="350" frameborder="0"></iframe>
Hi i am trying to get an image to display when a result is picked from a data base this is my code below:
$box .= '<div style="margin-top:10px;height:120px;"id=\"Video\">
<br/>
<div style="border-style:solid;border-width:1px;border-color:#00000;width:400px;float:right;"id=\"Title\">'.$row['title'].'</div>
<div style="width:220px;height:150px;float:left;border-style:solid;border-width:1px;border-color:#000000;" id=\"VideoImage\">"
<img class="partimg1" src="classroom/images/'.$row['media_id'].'.jpg" /></div>
<div style="height:50px;width:400px;float:right;padding:2px;margin-bottom:5px;" id=\"Blurb\">'.$row['blurb'].'</div>
<div style="height:21px;width:152px;margin-top:45px;margin-left:7px;background:url(images/bg_top_img2-09.jpg) repeat-x;color:#ffffff;padding-left:2px;float:left;border:1px solid #000000;position:relative;border-radius:15px;text-align:center;" id=\"Downloads\"> Download </div>
</div>';
the line with in the middle is where the image should be the .$row['media_id']. this will be a value from the database it will only be a number so for example 1 up to 50 and in the images folder the images are named 1 to 50 and they are all JPG is there something that i have missed because i have used this before and it worked.
all that displays on the screen is a broken image link like when the web page cannot find the image in the folder.
any help would be much appreciated.
You break the src link.
src=\"classroom/images/'.$row['media_id'].'.jpg\"/>
As you use simple quote ' for string delimiter, you don't need to escape double ones "
<img class=\"partimg1\" src=\"classroom/images/"'.$row['media_id'].'".jpg\"/>
Should be
<img class="partimg1" src="classroom/images/'.$row['media_id'].'.jpg" />
You also need to fix all your id attributes
I am trying to echo in php the image description in the data-caption of the clearing image gallery of Foundation3 but it is not working. Here is my code:
<li class="clearing-feature">
<a href="administration/galleri/kcfinder/upload/images/Galleri1/1.jpg">
<img data-caption="<?php echo $myDataBild1 ?>;" src="kcfinder/upload/images/Galleri1/1.jpg"></a>
</li>
This is not working. The image gallery is still working correctly but the caption in this picture is not showing. How can I correct this?
NOTE: The php $myDataBild1 is a txt file with text inserted via CKEditor and it is working just fine. Let me know if you need the code and the variable is shown if I echo it anywhere else.
Misplaced comma - also try by using addslashes.
<img data-caption="<?php echo addslashes($myDataBild1); ?>" src="kcfinder/upload/images/Galleri1/1.jpg"></a>
I've been able to put some code together and get a QR code to display on my site. Now I'm attempting to get the QR Code to open a larger version inside colorbox. This is the code I've got so far:
<a href="<?php echo $????; ?>" title="<?php echo $heading_title; ?>"
class="colorbox" rel="colorbox">
<img src="http://chart.apis.google.com/chart?chs=250x250&cht=qr&chld=L&chl=
<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>"
alt="Product QR Code" width="80" height="80" style="float: right" /></a>
All the code for colorbox is on this page already as I have products that use this very function. The original code said echo $popup but when I use that it shows me the main product image so that's no good. What I can't figure out is what to do with echo in the href section so it calls the image again in the pop-up box but in a larger size?
I've tried using the same url as with the img src but it only returns garbage characters in the pop-up box and doesn't know to turn it into an image instead.
Thanks for your time!
When you assign colorbox, set the photo property to true. Example:
$('a.example').colorbox({photo:true});
Colorbox normally uses a regex to determine if a link is pointing to an image or not, but the URL you are using isn't going to pass that regex.