tommytomato Posted December 6, 2009 Share Posted December 6, 2009 Hi all I got the Gallery2 up and running OK, thumbnails are working ok I wanted to display ramdom image on another site, ( Wordpress ) I'm testing every thing on localhost first Gallery 2 ( Image Block Settings ) give me the code to do so ! <?php @readfile('http://localhost/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?> I've tried a number of diffferent ways to get this working, all it does is nothing, NO image shows up ! Code I now have is like so, it shows 5 images at 125 x 125 I wanted to place the G2 code in place so it shows ramdom image block here is my code, is there a way to get it to work with what I got, I'm not really good a php, but I am learning as I go along, could some one please help me out <div class="125ads"> <a href="http://www.rockinghamvisitorcentre.com.au/"><img src="<?php bloginfo('stylesheet_directory');?>/images/sskwinana.gif" alt="SS Kwinana #1" width="125" height="125" /></a> this is repeated 5 time's in the .php file I have site is down due to me making a mistake with Adsence add's, but here's a screen rip of my site were the images are top right 5 in a row TT Link to comment https://forums.phpfreaks.com/topic/184141-insert-image-block/ Share on other sites More sharing options...
BenInBlack Posted December 6, 2009 Share Posted December 6, 2009 PHP doesn't return binary data by nature you have to tell it to do it. What you have to do is read the image file into a var in php in binary and then tell control the header so that it looks to the calling code as an image Psudo code readimage.php ob_start(); ... code to read the image in to var ... var image = read(.... var image_name = "blahblah.jpg"; ob_clean(); header('Content-Type: image/jpeg'); header('Content-disposition: filename='.$image_name); echo $image; and in calling html code you would do something like <img src="http://..../readimage.php"> This might not meet your exact need but it should help you understand how to pass images thru php Link to comment https://forums.phpfreaks.com/topic/184141-insert-image-block/#findComment-972252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.