Kod:
<?php
$img = "1.jpg";
list($width, $height, $type, $attr) = getimagesize($img);
echo "<img class='resize' src=\"$img\" $attr />";
?>
<style>
img.resize{
<?php
if($width>100){
echo"width:100px;";
}
?>
}
</style>
Med modifikation efter vad du söker kan nog detta funka.