Jump to content

Insert image block


tommytomato

Recommended Posts

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 !

 

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

 

screenshot2e.th.png

 

TT

Link to comment
https://forums.phpfreaks.com/topic/184141-insert-image-block/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.