Welcome Guest, Not a member yet? Register   Sign In
Image Library
#1

[eluser]Kemik[/eluser]
Hello,

Please check the following code. My host says they have GD2 support so I'm unsure why the displayed text says "Your server does not support the GD function required to process this type of image."

Code:
$this->load->library('image_lib');

$config['image_library'] = 'GD2';
$config['source_image'] = 'image/sig.gif';
$config['wm_text'] = '[OCW] Kemik';
$config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/texb.ttf';
$config['wm_font_size'] = '12';
$config['wm_font_color'] = 'eeeded';
$config['wm_vrt_offset'] = '75';
$config['wm_hor_offset'] = '12';
$config['dynamic_output'] = TRUE;
$config['quality'] = '100';

$this->image_lib->initialize($config);        

if (!$this->image_lib->watermark()) {
    echo $this->image_lib->display_errors();
}

Thanks.
#2

[eluser]omed habib[/eluser]
Did you ever get a solution to this? I'm having the same problems..
#3

[eluser]ELRafael[/eluser]
a phpinfo can show if your server supports GD2.

This is from my phpinfo.
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
#4

[eluser]omed habib[/eluser]
Already checked the gd version on my server, it supports gd2 with all the image types enabled.
#5

[eluser]Michael Wales[/eluser]
Was your GD2 installation compiled with True Type support? Has the image been given the correct permissions (chmod 777)?
#6

[eluser]omed habib[/eluser]
I can tell ya this much, I found this code on the Internet and it works perfect. However, I'd still like to figure out the problem with the CI Image class so I can use the watermark features too...


Code:
// function createThumb creates and saves thumbnail image.
    // returns boolean $success
    // uses older GD library functions if current ones are not available
    // parameter string $filePath path to source image
    // parameter string $thumbPath path to new thumbnail
    function createThumb($filePath, $thumbPath) {
        $thumbHeight = 77;
        $thumbWidth = 115;
        $quality = 200;    
        // Get the image dimensions.
        $dimensions = @getimagesize($filePath);
        $width        = $dimensions[0];
        $height        = $dimensions[1];

        $smallerSide = min($width, $height);

        // Calculate offset of square portion of image
        // offsets will both be zero if original image is square
        $deltaX = ($width - $smallerSide)/2;
        $deltaY = ($height - $smallerSide)/2;
        
        // get image identifier for source image
        $imageSrc  = @imagecreatefromjpeg($filePath);
        // Create an empty thumbnail image.
        $imageDest = @imagecreatetruecolor($thumbWidth, $thumbHeight);
        $success = @imagecopyresampled(
                        $imageDest,     // Destination image
                        $imageSrc,         // Source image
                        0,                 // X coordinate of destination point
                        0,                 // Y coordinate of destination point
                        $deltaX,         // X coordinate of source point
                        $deltaY,         // Y coordinate of source point
                        $thumbWidth,         // Destination width
                        $thumbHeight,        // Destination height
                        $smallerSide,         // Source width
                        $smallerSide        // Source height
                    );
        if (!$success) {return false;} {
            // save the thumbnail image into a file.
            $success = @imagejpeg($imageDest, $thumbPath, $quality);
            // Delete both image resources.
            @imagedestroy($imageSrc);
            @imagedestroy($imageDest);                        
        }    
        return $success;
    }




Theme © iAndrew 2016 - Forum software by © MyBB