PDA

View Full Version : Display Street View Embeds from a MySQL Database



Adrian Patterson
12-30-2014, 02:41 PM
Hi, apologies for the simplicity of this question which I could not find among the FAQs.


I have a MySQL database and have been displaying images from the database using the following code from a Php file

echo "<td>" ."<img src=\"". $row['Link'] ."\" alt=\"\" />". "</td>";

I would like to insert the http information relating to Street view and display it as it appears on the http://www.gearthhacks.com/streetview/ main page, basically as a picture file which the user can interact with.

The location I was experimenting with was as follows in my database

https://www.google.com/maps/@55.9456057,-3.1911527,3a,75y,103.13h,83.53t/data=!3m4!1e1!3m2!1sp_DSpjO2UCoWUMkSX-sk1g!2e0?hl=en-GB


I had hoped it would be as easy as inserting the https link into my database and that it would display along with the other images I have collected, though I also realize some code will have to be included to size the resulting image displayed. The embedded link works perfectly on my site when I add it between html tags as follows <iframe src="https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2suk!4v1419949926923!6m8!1m 7!1sp_DSpjO2UCoWUMkSX-sk1g!2m2!1d55.94560574794457!2d-3.191152667883733!3f103.12935!4f-6.470590000000001!5f0.7820865974627469" width="600" height="450" frameborder="0" style="border:0"></iframe>

but as I say I would like to use my database as a data source for the image.

Ultimately I would require users to my website to upload their own chosen locations via a form in the same way as they can upload other images with url's.

Can anyone assist me, please.

Thanks

Adrian Patterson :)

Adrian Patterson
01-06-2015, 11:44 AM
Hi, apologies for the simplicity of this question which I could not find among the FAQs.


I have a MySQL database and have been displaying images from the database using the following code from a Php file

echo "<td>" ."<img src=\"". $row['Link'] ."\" alt=\"\" />". "</td>";

I would like to insert the http information relating to Street view and display it as it appears on the http://www.gearthhacks.com/streetview/ main page, basically as a picture file which the user can interact with.

The location I was experimenting with was as follows in my database

https://www.google.com/maps/@55.9456057,-3.1911527,3a,75y,103.13h,83.53t/data=!3m4!1e1!3m2!1sp_DSpjO2UCoWUMkSX-sk1g!2e0?hl=en-GB


I had hoped it would be as easy as inserting the https link into my database and that it would display along with the other images I have collected, though I also realize some code will have to be included to size the resulting image displayed. The embedded link works perfectly on my site when I add it between html tags as follows <iframe src="https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2suk!4v1419949926923!6m8!1m 7!1sp_DSpjO2UCoWUMkSX-sk1g!2m2!1d55.94560574794457!2d-3.191152667883733!3f103.12935!4f-6.470590000000001!5f0.7820865974627469" width="600" height="450" frameborder="0" style="border:0"></iframe>

but as I say I would like to use my database as a data source for the image.

Ultimately I would require users to my website to upload their own chosen locations via a form in the same way as they can upload other images with url's.

Can anyone assist me, please.

Thanks

Adrian Patterson :)

Fortunately I was able to solve my own problem, which was to simply replace the img src tags in my php code on the html page with the iframe equivalent on either side of the field from the database. Simple but sometimes difficult just to know that this is the right thing to do.