edited the same time you made your post.
Quote:
edit: another option would be disableing the image resize process. Then you should make sure that your attachments are allready uploaded in the size the slider does need.
|
That would be (untested):
replace
Code:
//rebuild image to the height and width we want in the slider
//called sprite since i got the code from our sprite addon :P
$sprite = imagecreatetruecolor($maxwidth, $maxheight);
if(is_resource($sprite) AND $article['previewimage'] )
{
$imageinfo = getimagesize($article['previewimage']);
if(is_array($imageinfo))
{
$image = null;
switch($imageinfo[2])
{
case IMAGETYPE_PNG:
$image = imagecreatefrompng($article['previewimage']);
break;
case IMAGETYPE_GIF:
$image = imagecreatefromgif($article['previewimage']);
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($article['previewimage']);
break;
default:
echo '<span style="color:red">Error occurred:</span> Unknown image format. ' . $article['previewimage']. '<br />';
break;
}
if(!is_resource($image))
{
//resiziing did not work - we are using the fallback image.
$article['previewimage'] = $fallback_img;
echo '<span style="color:red">Error occurred:</span> imagecreation failed. ' . $article['previewimage']. '<br />';
}
else
{
$img_width = $imageinfo[0];
$img_height = $imageinfo[1];
imagecopyresampled($sprite, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
imagedestroy($sprite);
if($success)
{
$article['previewimage'] = $img_filepath;
}
else
{
$img_filepath = DIR . ($img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath;
echo '<span style="color:red">Error occurred:</span> imagejpeg failed. ' . $article['previewimage']. '<br />
directory: '. $img_filepath ;
$article['previewimage'] = $fallback_img;
}
}
}
else
{
//resiziing did not work - we are using the fallback image.
$article['previewimage'] = $fallback_img;
echo '<span style="color:red">Error occurred:</span> picture is not readable.' . $article['previewimage']. '<br /> ';
}
}
else
{
//resiziing did not work - we are using the fallback image.
$article['previewimage'] = $fallback_img;
echo '<span style="color:red">Warning:</span> article has no previewimage or sprite is no ressource. ' . $article['previewimage']. '<br />';
}
with
Code:
if($article['previewimage'] )
{
//do nothing
}
else
{
$article['previewimage'] = $fallback_img;
echo '<span style="color:red">Warning:</span> article has no previewimage or sprite is no ressource. ' . $article['previewimage']. '<br />';
}
Pictures should show up then. But it might look odd if the pictures do not have the right width and height.