Welcome Guest, Not a member yet? Register   Sign In
Image Moo - Image manipulation library
#51

[eluser]ClaudioX[/eluser]
OMG, auhauha, i probably see now, in the image tag put the image_resize uri (controller/func_resizer/image_path)

To image_path i use:

Code:
public function setSpecialChar($string){
    return str_replace( '=', '', base64_encode( ($string) ) );
}
public function getSpecialChar($string){
    return utf8_decode( base64_decode($string) );
}

Thx again for all help!

humm, CI have someway to cache this? for now i dont want create another file..

"Warning: Because of the way CodeIgniter stores content for output, caching will only work if you are generating display for your controller with a view."

Damn it!
#52

[eluser]Mat-Moo[/eluser]
Caching would write another file anyway Smile
#53

[eluser]Irfan Cikoglu[/eluser]
Amazing library, thanks.

Can we use URL for load?
#54

[eluser]Mat-Moo[/eluser]
Not sure, why don't you try it and let us know.
#55

[eluser]Irfan Cikoglu[/eluser]
It doesn't works with URL but i fixed. Hope this helps Smile
Now you can use local image or remote URL for manipulating. Wink

Download:
http://pastebin.com/raw.php?i=hTwccqHg

Usage:
Code:
$this->load->library('image_moo');
    $this->image_moo
        ->load("http://somewebsite.com/someimage.jpg")
        ->resize(200,200)
        ->save("thumb.x");
    if ($this->image_moo->error) print $this->image_moo->display_errors();

CHANGED: _load_image() function
ADDED: _check_url() function

Regards.
#56

[eluser]fatdog[/eluser]
[quote author="Mat-Moo" date="1309232350"][quote author="Philo01" date="1303932815"]Great library! =)
I noticed that it doesn't support the resize of transparent PNG images at the time so for those who are interested in this, open image_moo.php and look for ( line 552 ):

Code:
// if padding, fill background
if ($pad)
{
     $col = $this->_html2rgb($this->background_colour);
     $bg = imagecolorallocate($this->temp_image, $col[0], $col[1], $col[2]);
     imagefilledrectangle($this->temp_image, 0, 0, $tx, $ty, $bg);
}

Add the following below:

Code:
imagealphablending($this->temp_image, false);
imagesavealpha($this->temp_image, true);
$color = imagecolorallocatealpha($this->temp_image, 0, 0, 0, 127);
imagefilledrectangle($this->temp_image, 0, 0, $this->width, $this->height, $color);

That should do it! Smile

Kind regards,

Philo[/quote]

Where should this be added? after the pad code? I need ot work on keeping transparency data![/quote]

The code goes inside the pad block.
But this line:
Code:
imagefilledrectangle($this->temp_image, 0, 0, $this->width, $this->height, $color);

Should be changed to:
Code:
imagefilledrectangle($this->temp_image, 0, 0, $tx, $ty, $color);

That's how I made it work
#57

[eluser]Unknown[/eluser]
When I display a png image with save_dynamic

if the orignal file background is transparent
its show in black when I display it

someone know how to fix it?
#58

[eluser]nikes[/eluser]
Cool lib! many thanks quite an ideal offer for sharing
#59

[eluser]S-Vizion Software and Development[/eluser]
Out of curiosity, when I try to watermark a image, it saves the image but never makes the watermark work. From what I've read am I doing this correctly

Quick Edit

$this->watermark_text = string
$this->watermark_font = realpath ( APPPATH . '../../assets/fonts/Sniglet-webfont.ttf');

Code:
$this->load->library('pictures/image_moo');

    if ( $this->do_watermark === false )
    {
     $this->image_moo->load( $fullpath )
             ->resize( $this->image_width, $this->image_height )->save( $this->image_path . '/' . $filename . $fileext )
             ->resize($this->large_thumb_width, $this->large_thumb_height )->save( $this->image_path . '/thumbs/' . $filename . '_medium' . $fileext )
             ->resize($this->small_thumb_width, $this->small_thumb_height )->save( $this->image_path . '/thumbs/' . $filename . '_small' . $fileext );
    } else {
     $this->image_moo->load( $fullpath )
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 16, '#000')
             ->resize( $this->image_width, $this->image_height )->save( $this->image_path . '/' . $filename . $fileext , true)
             ->watermark(2)
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 12, '#000' )
             ->resize($this->large_thumb_width, $this->large_thumb_height )->save( $this->image_path . '/thumbs/' . $filename . '_medium' . $fileext, true )
             ->watermark(2)
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 9, '#000' )
             ->resize($this->small_thumb_width, $this->small_thumb_height )->save( $this->image_path . '/thumbs/' . $filename . '_small' . $fileext , true)
             ->watermark(2);


    }

Thanks

Nevermind I just noticed my watermark's were after the saves duh

Code:
$this->image_moo->load( $fullpath )
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 16, '#000')
             ->resize( $this->image_width, $this->image_height )->watermark(2)
             ->save( $this->image_path . '/' . $filename . $fileext , true)
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 12, '#000' )
             ->resize($this->large_thumb_width, $this->large_thumb_height )
             ->watermark(2)
             ->save( $this->image_path . '/thumbs/' . $filename . '_medium' . $fileext, true )
             ->make_watermark_text( $this->watermark_text , $this->watermark_font , 9, '#000' )
             ->resize($this->small_thumb_width, $this->small_thumb_height )
             ->watermark(2)
             ->save( $this->image_path . '/thumbs/' . $filename . '_small' . $fileext , true);

Proper method of doing it
#60

[eluser]Mat-Moo[/eluser]
Have you tried seeing if there is any errors? if ($this->image_moo->errors) print $this->image_moo->display_errors();




Theme © iAndrew 2016 - Forum software by © MyBB