Jump to content

image resize


wxpsadd

Recommended Posts

hi guys,

 

i'm stuck in these problem where i want to resize an image if its larger than my standard size. so i tried to display those image attributes like width and height using javascript. but sad to say, only the last record on mysql displays the attributes. if only it would display the image attributes on all the records it would be easy to compare if my images are larger or on standard sizes. can someone help me on this? or is there any other way i can resize compare image sizes?

 

i used these simple code below:

 

$sql = "select * from tbl";
result = mysql_query($sql);

echo '<form name=form1">';
echo '<table width="500">';

while($row=mysql_fetch_assoc($result)){

//javascript

echo '

<script>
window.onload=imgs;

function imgs()
{
var imageheight'.$row["name"].';
var imagewidth'.$row["name"].';

imageheight'.$row["name"].' = document.form1.pic_'.$row["name"].'.height;
imagewidth'.$row["name"].' = document.form1.pic_'.$row["name"].'.width;

document.form1.iheight'.$row["name"].'.value = imageheight'.$row["name"].'
document.form1.iwidth'.$row["name"].'.value = imagewidth'.$row["name"].'

}
</script>

';

echo '<tr>';
echo '<td>';
echo '<img src="'.$row["image"].'.jpg" name="pic_'.$row["image"].'">';
echo '<input type="text" name="iheight'.$row["name"].'">';
echo '<input type="text" name="iwidth'.$row["name"].'">';
echo '</td>';
echo '</tr>';

}

echo '</table>';
echo '</form>';

 

Link to comment
https://forums.phpfreaks.com/topic/132092-image-resize/
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.