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

[eluser]Mat-Moo[/eluser]
I made some modifications to processing png transparency watermarks and forgot to update the text part. This is now fixed in 1.0.1 which I'll upload to my site soon.
#32

[eluser]HomersBrain[/eluser]
Thanks for the quick update. Thats working now.

As a site note, when you specify vertical text, it's chopping off the top part of the font. It's to do with x co-ords of the imagefttext function.

eg: imagefttext($this->watermark_image, $size, $angle, 0, $bh-$bl, $font_col, $fontfile, $text);

The 0 works fine for horizontal text. If I want vertical text, I had to change the 0 to 20 (in my case) to stop it cutting the top of the text off.

Cheers

Mike
#33

[eluser]Mat-Moo[/eluser]
In the bugs it does say not fully working with rotated text Smile I'll have to put some time ont hat soon Smile
#34

[eluser]HomersBrain[/eluser]
[quote author="Mat-Moo" date="1292271619"]In the bugs it does say not fully working with rotated text Smile [/quote]

Documentation? Who reads documentation? :lol:

Thanks Smile
#35

[eluser]theRiley[/eluser]
Great library it's worked for many different things I need.

Running into a problem with large large files... like 2000px x 3000px. When i upload anything large like that it just goes to a blank white page. i've put in the code for

"$this->image_moo->display_errors();"

in several different places, but still cant' get it to print anything. It's all local for now, and it's uploading the photo to the right directory, just when it gets to this part:

Code:
if ($width >= $maxWidth || $height >= $maxHeight) {
$this->image_moo
->load($filename)
->resize($maxWidth, $maxHeight)
->save($filename, $overwrite=TRUE);
}

It's not changing the photo size, and goes to that white page.

If the image is large enough to trigger this code (to go over my max width or max height) then the code DOES resize the photo and works (unless the photo is very very large). That's why i think it has to do with memory limits or something...

Any ideas about large photos or memory limits? Or even a better suggestion where i could track or see errors.

Thanks for any help
#36

[eluser]Mat-Moo[/eluser]
Sounds like PHP running out of memory, will be a server/php setting, not a limitation of the library. But for a photo that size, your looking at around 30MB working space just to load the image in memory (2000 x 3000 x 4)
#37

[eluser]theRiley[/eluser]
Ah, yes that worked, upped my limit locally.

Even though it wasn't an Image Moo problem thanks for your reply
#38

[eluser]mcrumley[/eluser]
Here is a function I added to crop the image to a specific aspect ratio.

Code:
// crop to 16x9
$this->image_moo->load('example.jpg')->ratio(16, 9)->save_dynamic();


Code:
public function ratio($width, $height, $rotate = false, $stretch = false)
    //----------------------------------------------------------------------------------------------------------
    // Crop the original image to the aspect ratio $width x $height
    // $rotate - keep the original image orientation even if the aspect ratio does not match
    // $stretch - stretch the image to fit instead of crop
    //----------------------------------------------------------------------------------------------------------
    {
        $ratio = $width / $height;
        $current_ratio = $this->width / $this->height;

        // if rotate is true and the current ratio and requested ratio are different directions
        // switch the width and height
        if ($rotate && (($ratio < 1 && $current_ratio > 1) || ($ratio > 1 && $current_ratio < 1))) {
            $ratio = $height / $width;
        }

        // if the current ratio is the same as the requested ratio do nothing
        if ($current_ratio == $ratio) {
            // return object
            return $this;
        }
        // if the image is wider than the requested ratio
        // use the current height and figure out the width
        if ($current_ratio > $ratio) {
            $w = $this->height * $ratio;
            $h = $this->height;
        // if the image is narrower than the requested ratio
        // use the current width and figure out the height
        } else {
            $w = $this->width;
            $h = $this->width / $ratio;
        }

        // stretch or crop the image
        if ($stretch) {
            $this->stretch($w, $h);
        } else {
            $this->resize_crop($w, $h);
        }

        // return object
        return $this;
    }
#39

[eluser]rockbust[/eluser]
[quote author="tkyy" date="1280127250"] i can grab the code from one of my projects soon and post it for you.

[/quote]

Doug, is that the code from my project you ripped me off of my $500. This money could have went to an real programmer. Never to late to fix the situation.
http://ellislab.com/forums/viewthread/170501/#812425
#40

[eluser]Unknown[/eluser]
Hi,

To start with: Thanks for a great library - it really saved me a lot of time for a project I'm working on!

I noticed a couple of possible errors in your samples and in the library, with regards to error handling:

- The row if ($this->image_moo->error) print $this->image_moo->display_errors(); in your samples seems to be missing an 's' at the end of $this->image_moo->error (I saw you had a couple of samples with 'errors' instead of 'error' though)[/quote]

- The $errors parameter in image_moo.php was never reset to FALSE once it has become TRUE - I changed in my copy to reset it in _clear_errors(). Before doing that, any loop would keep checking that parameter and return FALSE for any subsequent checks, even when there is no actual error in the current iteration.




Theme © iAndrew 2016 - Forum software by © MyBB