DB Images
-
Could you please let me know if this plug in supports the return of Database images, such as jpeg? this would be incredibly useful
thank you.
-
If not, what about hyperlinks?
There’s no special support for images.
It looks as if database images could be introduced into the HTML inline if you send to the browser encoded in base64. You should be able to create those encodings from jpegs using
string base64_encode ( string $data )in a PHP snippet. But you could quickly get into performance issues.Do you mean hyperlinks in a column in the database – in which case yes. You just use a PHP snippet in a column to wrap the link in that column with the associated text (in another database column) with a pair A tags. There are hyperlinks in the example snippets that navigate wp_post etc. But will post an simple example if you need one.
John
I have just tried the following
SELECT ColA, ‘<img src=”https://www.google.co.uk/images/srpr/logo11w.png” />’ AS ‘ColB’
FROMTableABut this just shows the URL. What am I doing wrong?
thanks
This usable SQL does not work for me either: `SELECT ID, ‘<img src=”https://www.google.co.uk/images/srpr/logo11w.png” />’ AS ‘ColB’
FROM wp_posts limit 2`I am not sure what’s wrong. If I use chrome inspect element, your HTML is there but greyed out. I think there maybe some level of anti HTML injection going on somewhere.
However this works, try a PHP snippet above the first column, your google image is displayed
return "<img src=\"https://www.google.co.uk/images/srpr/logo11w.png\" />";This also works: try using the SQL
SELECT ID, ‘https://www.google.co.uk/images/srpr/logo11w.png’ AS ‘ColB’ FROM wp_posts limit 2
with the PHP snippet return “<img src=’$value’ />”;Thank you for your reply although I don’t fully understand the php snippet return thing. Could you please explain that part in more detail as I thought I could only enter a simple query
Ive got it 🙂 ive managed to get the images to display, the only problem is making the image a clickable link. Any ideas?
thanks again
Ok. Are you using just SQl or SQL + php, I am not sure where we are starting from.
Im not 100% sure, just SQL i think. this is what im trying to do
http://www.predictresults.co.uk/test/
if you look at the flashing gifs, I just want those to be clickable links.
Many thanks for your help
I’ve tried adding href to the snippets but either I’ve added it incorrectly or its not supported.
Can you let me know if its possible please
Thank you
If you this SQL
SELECT ID, 'https://www.google.co.uk/images/srpr/logo11w.png' AS 'image', 'http://www.google.com' as 'link' FROM wp_posts limit 2and this PHP snippet above the link column
return "<a href='".$value."'><img src='".$row['image']."'./>/a>";you can click on the images in the 3rd column and get taken to google.
Excellent, the link works but is there a way to hide the url in the image column as this doesnt need to be seen?
thank you
Yes, someone has raised that before. My only suggestion is to use CSS to hide the column or put
return '';as a PHP snippet in the top of the unwanted column which will blank the column. Put the the column in the middle of the table and make it a feature! There does need to be a clean way to suppress display columns and sorry don’t have time to implement on this at moment.
I was so close, but so far away, the code worked, wasnt ideal with the extra header but I could live with that.
Turns out the DBView hates using this when the Tables return 0 data.
Rather than return 0 it just spins and spins 🙁
have a look at http://www.predictresults.co.uk/full-list-of-football-tips/
4 Star Home Wins is pretty good, but then look at 4 Star Low Scoring, its knackered
Ive had to remove it, the error im getting is
Warning: array_key_exists() expects parameter 2 to be array, null given in /BLAR BLAR/wp-content/plugins/dbview/DBViewTable.class.php on line 188
Warning: array_key_exists() expects parameter 2 to be array, null given in /BLAR BLAR/wp-content/plugins/dbview/DBViewTable.class.php on line 188
Warning: Cannot modify header information – headers already sent by (output started at /BLAR BLAR/wp-content/plugins/dbview/DBViewTable.class.php:188) in /BLAR BLAR/wp-content/plugins/dbview/DBView.class.php on line 654
{“success”:true,”messages”:[],”updates”:[{“html”:”\r\n<\/tbody>\r\n<\/table style=’width:98%’>”}],”_ajax_nonce”:”f459d6368c”}
0 items<\/span><\/th><\/tr>
Bet Now<\/span><\/th> ..<\/span><\/th><\/tr><\/thead>\r\nSorry. Try returning one space. Or
return " " ;
The topic ‘DB Images’ is closed to new replies.