Jump to content

image


corillo181

Recommended Posts

under wher ein php info would i find that?

cuz i tthink is if i had gd? and my server do

i try this but it does not work.
[code]
<?php
function imageResize($width, $height, $target) {
if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}
$width = round($width * $percentage);
$height = round($height * $percentage);
return "width=\"$width\" height=\"$height\"";
}

include 'includes/db.php';
$query=mysql_query("SELECT path FROM tra_cotm_photo")or die("error: ".mysql_error());
$path=mysql_fetch_array($query);
$test = getimagesize("../cotm/457565197.jpg");
?>
<img src="../cotm/457565197.jpg" <?php imageResize($test[0],$test[1], 110); ?> />
[/code]
Link to comment
https://forums.phpfreaks.com/topic/12301-image/#findComment-46988
Share on other sites

If you have the GD library installed, it's clearly visible in phpinfo (it has its own section of information).

If you have GD installed and your code "doesn't work", there something not right wih your code. What is (not) happening with that script that makes you think there's a problem?
Link to comment
https://forums.phpfreaks.com/topic/12301-image/#findComment-46993
Share on other sites

Sorry, try this:
[code]$size = getimagesize("image/123.jpg");
echo "<img src='image/123.jpg' ". $size[3]. ">";[/code]
If GD is working and if image/123.jpg exists (it's your example, so I assume it would), then $size[3] will display the width and height of the image - exactly what it says in the php manual.
Link to comment
https://forums.phpfreaks.com/topic/12301-image/#findComment-47140
Share on other sites

this worked..i got the hang of it.. thanx
[code]

$filename = 'images/123.jpg';
$size = getimagesize("images/123.jpg");
$width=$size[0];
$height=$size[1];
if($width >100 || $height >100){
$n_w=$width / 2;
$n_h=$height / 2;
echo '<img src="images/123.jpg" width="'.$n_w.'" height="'.$n_h.'" />';
}
?>


[/code]
Link to comment
https://forums.phpfreaks.com/topic/12301-image/#findComment-47290
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.