Example #1
0
        $size[1] = $max_height;
    }
    return array($size[0], $size[1]);
}
function slideshow_resizer($imagefile)
{
    list($width_orig, $height_orig) = getimagesize($imagefile);
    list($nuwidth, $nuheight) = slideshow_sizeme(getimagesize($imagefile));
    $newImg = @imagecreatetruecolor($nuwidth, $nuheight) or die("Cannot Initialize new GD image stream");
    //@unlink($imagefile);
    if (eregi("\\.jpe?g\$", $imagefile)) {
        $OgImg = imagecreatefromjpeg($imagefile);
        ImageCopyResampled($newImg, $OgImg, 0, 0, 0, 0, $nuwidth, $nuheight, $width_orig, $height_orig);
        imagejpeg($newImg, $imagefile);
    } elseif (eregi("\\.png\$", $imagefile)) {
        $OgImg = imagecreatefrompng($imagefile);
        ImageCopyResampled($newImg, $OgImg, 0, 0, 0, 0, $nuwidth, $nuheight, $width_orig, $height_orig);
        imagepng($newImg, $imagefile);
    } elseif (eregi("\\.gif\$", $imagefile)) {
        $OgImg = imagecreatefromgif($imagefile);
        ImageCopyResampled($newImg, $OgImg, 0, 0, 0, 0, $nuwidth, $nuheight, $width_orig, $height_orig);
        imagegif($newImg, $imagefile);
Example #2
0
     //  Get a less pikey server ...
     error('Sorry, You need to enable GD to use this module');
 }
 ////////////////////////////////////////////////
 if ($slideshow->centred) {
     echo '<div align="center">';
 }
 //
 // $slideshow->layout defines thumbnail position
 // $slideshow->filename defines the position of captions. 1 is on top, 2 is bottom, 3 is on the right
 if ($slideshow->layout == 0) {
     // print thumbnail row
     slideshow_display_thumbs($filearray);
 }
 if ($img_count > 0) {
     list($width_orig, $height_orig) = slideshow_sizeme(getimagesize($course_dir . '/' . $showdir . '/' . $filearray[$img_num]));
     echo "\n";
     // process caption text
     $currentimage = slideshow_filetidy($filearray[$img_num]);
     if ($caption_array[$currentimage]['image'] != '') {
         $captionstring = html_entity_decode($caption_array[$currentimage]['caption']);
         $titlestring = $caption_array[$currentimage]['title'];
     } else {
         $captionstring = $currentimage;
     }
     //
     // if there is a title, show it!
     if ($titlestring) {
         echo '<h1>' . $titlestring . '</h1>';
     }
     $plaintext = strip_tags(str_replace('<', ' <', $captionstring));