brucehere Posted September 9, 2008 Share Posted September 9, 2008 Hi, I have some simple code that pulls some images from a gallery on my site and displays them on the frontpage. (Its in Drupal) <?php $numImage = 4; $images = image_get_random($numImage); for($i=0;$i<count($images);$i++) { echo l(image_display($images[$i], 'thumbnail'), 'node/'. $images[$i]->nid, array('html' => TRUE)); } ?> That works and everything great. But it displays the thumbnails all right next to each other. Id like there to be a small space between them and if possible on the same horizontal path. At the mo some are portrait orientation and some landscape, which makes it look a bit funny. It isn't the biggest issue if that cant be done. Otherwise just the spacing would be great. (sorry im not the strongest in php!) Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/ Share on other sites More sharing options...
lisa71283 Posted September 9, 2008 Share Posted September 9, 2008 Add a "padding-right: x;" attribute to the image, either using its CSS class, or an inline style="xyz" attribute to the IMG tag. Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637862 Share on other sites More sharing options...
brucehere Posted September 9, 2008 Author Share Posted September 9, 2008 I couldn't find the CSS file for it. I dont think there is one as this is a custom block Ive created. Is there any way I could just add some code into the PHP to create the breaks/alignment? Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637876 Share on other sites More sharing options...
lisa71283 Posted September 9, 2008 Share Posted September 9, 2008 <img src="whatever.png" style="padding-right: 15px;" alt="description" /> Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637880 Share on other sites More sharing options...
brucehere Posted September 9, 2008 Author Share Posted September 9, 2008 I cannot specify items to the image tag. As its constantly changing with various random images from a single gallery. All php based. If that is the code i should add into the PHP, please show me exactly where to put it? Sorry, my knowledge is very simple around this area. Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637884 Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 after you echo the image, echo ' '; Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637897 Share on other sites More sharing options...
brucehere Posted September 9, 2008 Author Share Posted September 9, 2008 sorry. im really bad at this. jsut getting errors... where exactly do i place that bit of code? Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637914 Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 on a line after the only line containing echo. we're trying to add a (HTML non-breaking space) after each image is echoed. Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637917 Share on other sites More sharing options...
brucehere Posted September 9, 2008 Author Share Posted September 9, 2008 ya, i can see that. However i have tried 100's of options now and still dont know the exact place to put it in?? PLease can you copy and paste my code with the correct   spacing code in it. Thanks. Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637927 Share on other sites More sharing options...
lisa71283 Posted September 9, 2008 Share Posted September 9, 2008 We cannot modify your code, as the snippet posted does not produce the output. The snippet posted calls image_display(), which either generates the HTML itself, or passes the arguments to another function. You will need to look at the source for image_display() and let us know if it is creating the HTML <IMG> tag. Once we find the code that is actually producing the HTML, then we can modify it as necessary. Link to comment https://forums.phpfreaks.com/topic/123513-basic-help-i-think/#findComment-637941 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.