0

Hello people,

I have a problem in displaying my images in the dimensions I wish: I used the following code:

echo'<td><a href="portsdetails.php?idImg='.$idphoto.'"><img src="'.$lien.'" width="10" height="10" border="0"/></a></td>';
5
Contributors
6
Replies
8
Views
6 Years
Discussion Span
Last Post by begueradj
0

I don't see your issue. Perhaps you could paste the whole html or link to the image?

0

I don't see your issue. Perhaps you could paste the whole html or link to the image?

Thank you, but I want to resize my image (which name is here: $lien) when displaying it in the dimensions I want. When I put : width="100" height="50" it does not take effect.

0

Open notepad or textpad and write a PHP code:

<?php

$imagepath="phpimages/dog.jpg";

$image=imagecreatefromjpeg($imagepath);

header('Content-Type: image/jpeg');

imagejpeg($image);

?>

Use above code that is working

0

html should resize. It doesn't actually resize the filesize, just the display, so it will load just as slowly as if it were displaying the actual size. Can't see why

echo "<a href=\"...\"><img src=\"$lien\" width=\"10\" height=\"10\" border=\"0\" /></a>";

doesn't work for you.

Edited by diafol: n/a

0
<?php

$p = $_GET['p'];
if ($handle = opendir("uploads")) {
	$i = 1;
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != "..") {
			$img[$i] = $file;
			if ($p == $img[$i]) {
				$ci = $i;
			}
			$i++;
		}
	}
	closedir($handle);
	$ti = $i - 1;
	$pi = $ci - 1;
	if ($p == "") {
		$ni = $ci + 2;
	} else {
		$ni = $ci + 1;
	}
	$prevNext = "";
	if ($pi > 0) {
		$piFile = $img[$pi];
		$prevNext .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?p=" . $piFile . "\" title=\"show previous image\"><strong>Previous</strong></a>";
	} else {
		$prevNext .= "<strong>Previous</strong>";
	}
	$prevNext .= " | ";
	if ($ni <= $ti) {
		$niFile = $img[$ni];
		$prevNext .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?p=" . $niFile . "\" title=\"show next image\"><strong>Next</strong></a>";
	} else 
	{
		$prevNext .= "<strong>Next</strong>";
	}
	
	
	if ($p == "") 
	{
		$p = $img[1];
	}
}
?> 


<div class="hRule"></div>

<table border="1" cellpadding="1" cellspacing="1" align="center">
	<tr align="center">
		<td class="nextPrevious"><?php echo $prevNext; ?></td>
	</tr>
	<tr align="center">
		<td> <img src="uploads/<?php echo $p; ?>" border="2"width="400" height="400"></td>
	</tr>
</table>

try this..

0

html should resize. It doesn't actually resize the filesize, just the display, so it will load just as slowly as if it were displaying the actual size. Can't see why

echo "<a href=\"...\"><img src=\"$lien\" width=\"10\" height=\"10\" border=\"0\" /></a>";

doesn't work for you.

Thank you very much it works thanks to your code:
I replaced echo'....';
by echo "...."; as you wrote it and it really works very fine !!!

Thank you very much again Ardav !

Begueradj

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.