I have a link that recieves a dyanamic image via php, and when you click it, it opens the image in a new window. It looks like this:
Click Here
I want to open the image on a page called red.php, and inside a div with the id=green.
From the sending page I'm thinking of something like this:
Click Here
On red.php the code would possibly be something like this:
<?php
$picture = $_GET['IMAGE_FULL_URL'];
echo ".$picture"
?>
I'm sure I have something wrong above, and I don't know where to begin to add the div id to the url, or if I can simply place the php code inside the div. Can someone please show me the code so this will work? Thanks.
here is an example:
your initial HTML:
Click Here
your Red.php:
<div id="green">
<img src="<?php echo urldecode($_GET['pic']); ?>" alt="" />
</div>
Related
I'm trying to open the user_url within an iframe on a private user page in Wordpress.
I put the following code into a snippet:
<?php echo get_the_author_meta('user_url',$userID); ?>
When I use the short code on the user page it does display the user URL, I can also use it in an hyperlink like this:
link text
But when I put the short code into an Iframe the short code does not change into the URL anymore.
<iframe src="[cmruncode name='dash']" height="300" width="300" title="Iframe"></iframe>
Does anyone knows why this is not working and know a solution?
Thanks Peter
If you are using WordPress shortcode then you have to call shotcode using function do_shortcode.
You can try this one
<iframe src="<?php echo do_shortcode( '[cmruncode name="dash"]' ); ?>" height="300" width="300" title="Iframe"></iframe>
And I'm not sure why anchort text display right output. That's weird.
Anyway if you used do_shortcode to output your shortcode then it will work every place.
This only works when I put it directly into the template, in that case no snippet-shortcode is needed at all. But the content needs to be hidden when the user is logged-out.
Normally the plugin "client portal" that I use should take care of this
but it has a content block that does not support PHP and also does not render the php snippet that I made.
Any suggestions?
The solution was to put the iframe code completely into a snippet.
Like this:
<iframe src="<?php echo the_author_meta('user_url',$userID); ?>" height="2400" width="100%" title="Iframe"></iframe>
I have a photo gallery, after a click on the thumbnail I want to open image but not file but another php page with this certain photo and some other stuff, how can I give link attributes that php can use from the link?
When you ask something here, you need to explain more about your doubt and share some of the code. I don't know about the context but if you need to generate a link from an image to PHP file with parameters, you can send parameters GET and put the image in the link tag.
<a href="your_php_page.php?param1=something¶m2=something">
<img border="0" alt="Description" src="thumbnail.jpg" width="100" height="100">
</a>
your_php_page.php
<?php
(isset($_GET['param1']))? $param1 = $_GET['param1'] : $param1 = null;
?>
More about GET parameters:
https://www.geeksforgeeks.org/how-to-get-parameters-from-a-url-string-in-php/
https://www.php.net/manual/en/reserved.variables.get.php
php newbie. echoing out links to product pages, the following code works fine:
<a href="<?php echo $rows[$product_buy];?>"<p>Click Here for Details</p></a>
but, would like to change text link "Click Here..." to an image of a button.
tried different ways, searched around, still haven't figured it out
You could simply style your link to look like a button (by giving it a class/id to make sure not all links are targeted) or you can put an img tag between the a tag.
<img src="path_to_img" alt="">
I'm doing a photo gallery for my site and I wanted to have all my added photos in database. I did everything good. Database responses with the "custom link" .. I mean for example that my photo has src like something.php?id=25 .. what I want is to open this image in fancybox (I already have fancybox installed on webpage, it shows normal-src-images well), but I'm not so good in js, etc. So I don't really know what should I do...
Basicly, the problem is that everytime I want to open the image, browser shows me image in his actual src, not in fancybox.
I did this, but It doesn't work:
<script type="text/javascript">
$(document).ready(function() {
$(".selector").fancybox({
'type' : 'image'
});
});
</script>
I found this script content -- $(".selector").fancybox({'type' : 'image'}); -- on the official web page of fancybox (they said it would help when I'm trying to open images from custom links), but It just doesn't work or I inserted it bad. I don't really know what I'm doing in js or jquery or what it is... can you guys help me with it ?
Here is a part of the source code from my gallery.php where I want fancybox to work (all scripts for fancybox are set good):
<div class="images">
<?php
include_once('actions/db_connection.php');
$query = "SELECT * FROM gallery";
$response = mysql_query($query, $connection)
if(!$response)
{
mysql_error();
}
else
{
while($qs = mysql_fetch_array($response))
{
echo '<a class="fancybox" rel="group" href="actions/download_large.php?image_ID='.$qs['image_ID'].'">
<img class="gallery" alt="image" src="actions/download_small.php?image_ID='.$qs['image_ID'].'"></a>';
}
}
?>
</div>
As I told my php "script" is showing my images good, so I think I just need some script to tell the fancybox how to open a link, but If you see something bad in code I'm opened for suggestions. Thank you so much. (Sorry for my english, hope you understand).. I'm running fancybox 2.
Can you try this,
$(".fancybox").fancybox({'type' : 'image'});
instead of
$(".selector").fancybox({'type' : 'image'});
I'm trying to construct a table on the right of the page where I pull out all the videos from the server. I want the users to click a row in the table and it starts to play a video in flowplayer on the left of the page. The video url is something I pull out of the DB.
<?php
for($i=0;$i<$num_videos;$i++)
{
?>
<tr onclick="DoNav('<?php echo $result_videos[$i]["video_url"]; ?>');">
<td>
...
Here's the javascript:
function DoNav(theUrl)
{
flowplayer("player", "flowplayer/flowplayer-3.2.7.swf", document.location.href = theUrl);
}
For whatever reason I can't seem to get flowplayer to work with this div:
<div id="player"><img src="recordings/landscape.jpg" width="320" height="240" /></div>
It will only prompt you to open or save the video instead of playing in the current window. If anyone knows this issue here that would be appreciated. At any rate, I know I can get flowplayer working with a href like so:
<a
href="url"
style="display:block;width:320px;height:240px;"
id="player"><img src="recordings/landscape.jpg" width="320" height="240" />
</a>
But I don't want to put the href in the table as I want that splash image included as well. Any ideas?
Edited to improve clarity.
When the function flowplayer("player", "flowplayer/flowplayer-3.2.7.swf", document.location.href = theUrl); Was called the document.location.href was being evluated and caused the browser to go to the theUrl which prompted for file to be downloaded.
Furthermore we found there is some sort of issue updating a with the as a child DOM object. This was solved by moving the image to the background of the using the inline CSS.
JS Code:
function DoNav(theUrl)
{
flowplayer("player", "flowplayer/flowplayer-3.2.7.swf", theUrl);
}
HTML table:
<div id="player" style="display:block;width:320px;height:240px;background-image:url(recordings/landscape.jpg)"></div>
PHP stayed the same.