javascript capture and display php variable - php

I have standard text links which all say "Full View". When clicked these links send out php in this form: http://mysite.com/fullview.php?myimage=30
Basically there's thumbnailed images and text links that say full view. I'd like for fullview.php to capture the myimage variable, and display it as a full sized image. Meaning, a blank page (fullview.php) displaying the image. Sounds likes javascript to me.
How do you put the javascript into fullview.php to capture the variable and display it as a full sized image?
Thanks for any help,
Darrell

php is server side script
javascript is client side script
so displaying a web page to a user first is executed php and result is send to client. After he receive it then javascript is executed
HTH
Ivo Stoykov

You just need to read the query parameters. In fullview.php you can use
$myimage = $_GET['myimage']; to capture this variable. And then can use it accordingly.

Related

How do I change the background using an image from another file?

I am making a website to keep track on my moviecollection. I have a page called "list.php" which lists all my movie titles. Each title is clickable. When you click the movie, an ajax function will retrieve information about the movie from another file called getmovie.php. Then a div expands and the information is being placed inside the expanded div. That was quite easy to make. To make the site more fancy I want to switch the background of list.php to be a poster from the "clicked" movie. The database stores the path to this poster, and getmovie.php will get that. But how can I change the background in list.php to a path being stored in getmovie.php?
Basicly I have a variable containing a path to an image I want to set as background in another file. How am I supposed to code that?
Thank you :)
I think you could use javascript to change document.body.background when you call the ajax function. For example, in the playMovie() function:
document.body.background = "images/movie01.jpg";
Hope it's useful.
As I tested with different methods, It is not possible to set a page's background from another page. However you can set the image from the page itself. You should do 2 ajaxs.. First you should get the text with a simple ajax as you have done that already. and Second get the background. write a php script that gets a movie input and displays ONLY the image url in the browser and then do an ajax and set the background of the new page using the retrieved url.

Bookmarklet Pass Images to Iframe

I am working on a bookmarklet and very near to finish it.
I got my earlier answer from open pop up after clicking bookmark link. Thanks to Treffynnon.
I have fetched Title, bookmarklet will fetch the current page information. I already fetched the title and passed it to the iframe using query string from js file. But I want to get all the images from the current page and want to show it on my iframe. Is this possible to pass images to the iframe in query string. Will the high size of query string effect it ?
Thanks
You can't pass the images content with JavaScript.
Possible solutions:
You can send all image URLs (but if the website doesn't support hotlinking, you won't see them on your website/iframe).
You can pass the page URL and grab its images by a server script.

How to save a CSS image on server with PHP

I want to make a button generator with javascript in my site, something like this http://css-tricks.com/examples/ButtonMaker/ .
But I want to add a save button too, so that the user will be able to save the button image he creates. I want to save the image in my server with PHP if possible.
Does anyone have an idea, of what should I really read or search for?
Thanks in advance
The button in the example generator is rendered by your browser. It is just a button element which is styled. I don't think you can easily save it using php.
What you could do is create a button generator that accepts parameters and then renders the image serverside (using php) and sends it to the browser for displaying. This rendered image can then easily be saved.
The link you've provided just defines the CSS for the element - you just eed to send this back to the server - via a form or ajax.
One approach would be to send the css settings to your server and execute an html renderer which somehow allows you to save a screenshot of the button.
Googling for "html renderer" yields several results, but I can't tell whether any of them offers an API that allows you to easily save images of desired elements.
(Of course, Firefox and Chrome all count as html renderers too).
In the worst scenario, using my approach, you'd have to render the button server side, take an screenshot and use some algorithm to find and cut the button from the screenshot.
I'd say this is a complicated approach overall. I'd go with what Iljaas' says.

Retrieve Title,Description and thumbnail of a url in php/Javascript/jqueryurl

As we post any url on facebook, it shows its meta-data(title, decription and thumbnail image), How can we achieve same thing in php or scripting language(javascript/jquery).
I believe, Facebook simply parses the html code of the Website behind the link and looks for <img /> tags. You can then choose any of the found images as picture for your link.
In PHP, you would fetch the websites HTML source via
$html = file_get_contents('http://...');
Then use regular expressions to find those <img /> tags.
you make an ajax hit to your server sending the URL
on the server side, get the url
parse it, extract the relevant info
send back the response as a either as JSON and parse it on the client side, either straight as HTML
There is a good plugin that can be used as a headstart.
It does not fetch the image, but it's a start if you want to implement your own
http://www.webinfopedia.com/extract-meta-data-from-url-using-php.html

Create points on screen with PHP

What I'm trying to do is load a website on a frame and then mark points on it depending on screen coordinates obtained via a function.
Do I need PHP GD?
Loading the website on the frame is not an issue. It's how to mark points on the screen that's causing my hair to fall
Nah, what you need are absolute positioned HTML elements.
You can grab the page with PHP with curl or file_get_contents() and inject some HTML/CSS into it that creates absolutely positioned <p>s or <span>s or whatever.
Checkout this post here. It uses Mootools(a JavaScript framework), PHP, and MySQL. I think it's very similar to what you are trying to do except you want to mark points on the iframe instead of doing it on an image. The plugin can be attached to an element:
David Walsh's Mootools Heatmap

Categories