Ok, so after tearing my hair out about why my site would sporadically generate SQL errors, I figured out that by removing my remote image gallery, I could stop the problem. I had a few images from flickr on my page that I would resize (using image resize and some math to generate the new dimensions). Even just having one image is causing those problems. I tried a small function that replicates getimagesize without using it (I hear there are some problems), but no luck.
What should I be doing in order to rectify. Here’s my code snippet:
[code=php]
<?
$size = getimagesize($row[‘img’.$i]);
$w = $size[0];
$h = $size[1];
$img[$i] = array(‘image’=>$row[‘img’.$i], ‘w’=>$w, ‘h’=>$h);
function getNewSize($w, $h, $width, $height){
if ($h > $w) {
$new_h = ($width / $w) * $h;
$new_w = $width;
$mTop = ($height/2)-($new_h/2);
$mLeft = 0;
} else {
$new_w = ($height / $h) * $w;
$new_h = $height;
$mTop = 0;
$mLeft = ($width/2)-($new_w/2);
}
return array($new_w, $new_h, $mTop, $mLeft);
}
for($i=1; $i<=3; $i++){
if($img[$i] != “”){
$size = getNewSize($img[$i][‘w’], $img[$i][‘h’], $width, $height);
$big = getNewSize($img[$i][‘w’], $img[$i][‘h’], $bigW, $bigH);
?>
<div class=’image’>
<img src='<?=$img[$i][‘image’]?>’ alt=’Image <?=$i?>’ width='<?=$size[0]?>’ height='<?=$size[1]?>’ style=’margin:<?=$size[2]?>px 0 0 <?=$size[3]?>px’ />
</div>
<?
}
}
?>