Support » Plugin: dbview » DB Images

Viewing 15 replies - 1 through 15 (of 36 total)
  • Thread Starter coleburg

    (@coleburg)

    If not, what about hyperlinks?

    Plugin Author john ackers

    (@john-ackers)

    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

    Thread Starter coleburg

    (@coleburg)

    I have just tried the following

    SELECT ColA, ‘<img src=”https://www.google.co.uk/images/srpr/logo11w.png&#8221; />’ AS ‘ColB’
    FROM TableA

    But this just shows the URL. What am I doing wrong?

    thanks

    Plugin Author john ackers

    (@john-ackers)

    This usable SQL does not work for me either: `SELECT ID, ‘<img src=”https://www.google.co.uk/images/srpr/logo11w.png&#8221; />’ 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&#8217; AS ‘ColB’ FROM wp_posts limit 2
    with the PHP snippet return “<img src=’$value’ />”;

    Thread Starter coleburg

    (@coleburg)

    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

    Thread Starter coleburg

    (@coleburg)

    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

    Plugin Author john ackers

    (@john-ackers)

    Ok. Are you using just SQl or SQL + php, I am not sure where we are starting from.

    Thread Starter coleburg

    (@coleburg)

    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

    Thread Starter coleburg

    (@coleburg)

    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

    Plugin Author john ackers

    (@john-ackers)

    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 2

    and 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.

    Thread Starter coleburg

    (@coleburg)

    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

    Plugin Author john ackers

    (@john-ackers)

    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.

    Thread Starter coleburg

    (@coleburg)

    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

    Thread Starter coleburg

    (@coleburg)

    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\n

    Plugin Author john ackers

    (@john-ackers)

    Sorry. Try returning one space. Or

    return "&nbsp;" ;

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘DB Images’ is closed to new replies.