Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

How can I put breaks between images?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

baris22

Established Member
Impact
1
Hello,

I have got this code

PHP:
$imageArray = array('jpg','gif','png');
$urls  = explode(';',$row['links']);
foreach($urls as $url)
{
if(in_array(substr($url,(-3)),$imageArray)){
echo '<img src="'.$url.'" />';
}
}

Images are showing one next to another one. What can i do to show them one on another one?

Thanks
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?php

// If you want each image on it's own line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" /><br /><br />";
	}
}

// OR - just a space between each image and they are on the same line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" />   ";
	}
}

?>
 
0
Close
Thank you very much


SecondVersion said:
PHP:
<?php

// If you want each image on it's own line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" /><br /><br />";
	}
}

// OR - just a space between each image and they are on the same line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" />   ";
	}
}

?>
 
0
Close
another way, would to be put something like style="padding-right:5px;" in the image tag, that way you can adjust the spacing in between the images at will.
 
0
Close
actually i think one <br /> should be good enough?

SecondVersion said:
PHP:
<?php

// If you want each image on it's own line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" /><br /><br />";
	}
}

// OR - just a space between each image and they are on the same line
$imageArray = array('jpg', 'gif', 'png');

$urls  = explode(';', $row['links']);

foreach ($urls AS $url)
{
	if (in_array(substr($url, -3), $imageArray))
	{
		echo "<img src=\"$url\" />   ";
	}
}

?>
 
0
Close
trlg said:
actually i think one <br /> should be good enough?
Just one <br /> would cause each image to touch each other. Two <br />'s would ensure a line between each.

However, to each his own.
 
0
Close
SecondVersion said:
Just one <br /> would cause each image to touch each other. Two <br />'s would ensure a line between each.

However, to each his own.
yeah, i guess. It would be a matter of how you interpreted the poster's question...
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back