Jump to content

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

tha tpage does nto resize with the function made.. so i think the imagesiz eit's not doign the work

and yes the gd is on..

plus i try using
[code]<img src="image/123.jpg" atl="<?php getimagesize("image/123.jpg");?>">
[/code]
to see if it would show me the image size but it doesn't..
Link to comment
https://forums.phpfreaks.com/topic/12301-image/#findComment-46995
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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.