library/crop/Image.php

.htaccess
LICENSE
PHPMailer
    .gitignore
    .scrutinizer.yml
    .travis.yml
    LICENSE
    PHPMailerAutoload.php
    README.md
    VERSION
    changelog.md
    class.phpmailer.php
    class.pop3.php
    class.smtp.php
    composer.json
    docs
        Callback_function_notes.txt
        DomainKeys_notes.txt
        Note_for_SMTP_debugging.txt
        extending.html
        faq.html
        generatedocs.sh
        pop3_article.txt
    examples
        code_generator.phps
        contents.html
        contentsutf8.html
        exceptions.phps
        gmail.phps
        images
            phpmailer.png
            phpmailer_mini.png
        index.html
        mail.phps
        mailing_list.phps
        pop_before_smtp.phps
        scripts
            XRegExp.js
            shAutoloader.js
            shBrushPhp.js
            shCore.js
            shLegacy.js
        send_file_upload.phps
        sendmail.phps
        smtp.phps
        smtp_check.phps
        smtp_no_auth.phps
        ssl_options.phps
        styles
            shCore.css
            shCoreDefault.css
            shCoreDjango.css
            shCoreEclipse.css
            shCoreEmacs.css
            shCoreFadeToGrey.css
            shCoreMDUltra.css
            shCoreMidnight.css
            shCoreRDark.css
            shThemeAppleScript.css
            shThemeDefault.css
            shThemeDjango.css
            shThemeEclipse.css
            shThemeEmacs.css
            shThemeFadeToGrey.css
            shThemeMDUltra.css
            shThemeMidnight.css
            shThemeRDark.css
            shThemeVisualStudio.css
            wrapping.png
    extras
        EasyPeasyICS.php
        README.md
        htmlfilter.php
        ntlm_sasl_client.php
    language
        phpmailer.lang-am.php
        phpmailer.lang-ar.php
        phpmailer.lang-az.php
        phpmailer.lang-be.php
        phpmailer.lang-bg.php
        phpmailer.lang-br.php
        phpmailer.lang-ca.php
        phpmailer.lang-ch.php
        phpmailer.lang-cz.php
        phpmailer.lang-de.php
        phpmailer.lang-dk.php
        phpmailer.lang-el.php
        phpmailer.lang-eo.php
        phpmailer.lang-es.php
        phpmailer.lang-et.php
        phpmailer.lang-fa.php
        phpmailer.lang-fi.php
        phpmailer.lang-fo.php
        phpmailer.lang-fr.php
        phpmailer.lang-gl.php
        phpmailer.lang-he.php
        phpmailer.lang-hr.php
        phpmailer.lang-hu.php
        phpmailer.lang-id.php
        phpmailer.lang-it.php
        phpmailer.lang-ja.php
        phpmailer.lang-ka.php
        phpmailer.lang-ko.php
        phpmailer.lang-lt.php
        phpmailer.lang-lv.php
        phpmailer.lang-ms.php
        phpmailer.lang-nl.php
        phpmailer.lang-no.php
        phpmailer.lang-pl.php
        phpmailer.lang-pt.php
        phpmailer.lang-ro.php
        phpmailer.lang-ru.php
        phpmailer.lang-se.php
        phpmailer.lang-sk.php
        phpmailer.lang-sl.php
        phpmailer.lang-sr.php
        phpmailer.lang-tr.php
        phpmailer.lang-uk.php
        phpmailer.lang-vi.php
        phpmailer.lang-zh.php
        phpmailer.lang-zh_cn.php
    test
        bootstrap.php
        fakepopserver.sh
        fakesendmail.sh
        phpmailerLangTest.php
        phpmailerTest.php
        runfakepopserver.sh
        test_callback.php
        testbootstrap-dist.php
    travis.phpunit.xml.dist
application
    .htaccess
    cache
        .htaccess
        index.html
    config
        autoload.php
        config.php
        constants.php
        database.php
        doctypes.php
        foreign_chars.php
        hooks.php
        index.html
        memcached.php
        migration.php
        mimes.php
        profiler.php
        routes.php
        smileys.php
        user_agents.php
    controllers
        Ioattachment.php
        Ioexport.php
        Iogroups.php
        Ioimport.php
        Iomessages.php
        Iosendmanager.php
        Iosends.php
        Iosignatures.php
        Iotimetable.php
        Mailing.php
        Welcome.php
        index.html
    core
        index.html
    helpers
        index.html
    hooks
        index.html
    index.html
    language
        arabic
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        azerbaijani
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        bulgarian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        catalan
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        czech
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        dutch
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        english
            index.html
            mailerattach_lang.php
            mailerexport_lang.php
            mailergroup_lang.php
            mailerimport_lang.php
            mailermailing_lang.php
            mailermain_lang.php
            mailermsg_lang.php
            mailersendmanager_lang.php
            mailersends_lang.php
            mailersignatures_lang.php
            mailertimetable_lang.php
        filipino
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        french
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        german
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        gujarati
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        hindi
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        hungarian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        index.html
        indonesian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        italian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        japanese
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        khmer
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        korean
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        latvian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        norwegian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        persian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        polish
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            mailerattach_lang.php
            mailerexport_lang.php
            mailergroup_lang.php
            mailerimport_lang.php
            mailerinstall_lang.php
            mailermailing_lang.php
            mailermain_lang.php
            mailermsg_lang.php
            mailersendmanager_lang.php
            mailersends_lang.php
            mailersignatures_lang.php
            mailertimetable_lang.php
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        portuguese
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        portuguese-brazilian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        romanian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        russian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        simplified-chinese
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        slovak
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        spanish
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        swedish
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        tamil
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        thai
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        traditional-chinese
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        turkish
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        ukrainian
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        urdu
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        vietnamese
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
    libraries
        index.html
    logs
        index.html
    models
        Attachment_model.php
        Export_model.php
        Groups_model.php
        Import_model.php
        Mailing_model.php
        Messages_model.php
        Sendmanager_model.php
        Sends_model.php
        Signatures_model.php
        System_model.php
        Timetable_model.php
        Track_model.php
        User_model.php
        index.html
    third_party
        index.html
    views
        about.php
        aboutrights.php
        addnewuser.php
        attachment
            attachment.php
        changepassword.php
        changeprofiledata.php
        errors
            cli
                error_404.php
                error_db.php
                error_exception.php
                error_general.php
                error_php.php
                index.html
            html
                error_404.php
                error_db.php
                error_exception.php
                error_general.php
                error_php.php
                index.html
            index.html
        export
            group.php
        foot.php
        footpop.php
        generatenewpassword.php
        generatepassword.php
        groups
            addemail.php
            edit.php
            editemail.php
            excaddemail.php
            exclusion.php
            export.php
            import.php
            index.php
            viewgroup.php
        head.php
        headpop.php
        import
            group.php
            groupimport.php
        index.html
        licensefail.php
        login.php
        logindenied.php
        logs.php
        mainpage.php
        messages
            editmessage.php
            empty.php
            index.php
            reportmessage.php
            statmessage.php
        norights.php
        options.php
        sendmanager
            sender.php
        sends
            edit.php
            index.php
        signatures
            edit.php
            index.php
        team.php
        timetable
            edit.php
            index.php
        welcome_message.php
arial.ttf
attachment
captcha
    sys.txt
favicon.ico
import
index.php
install.php
library
    add.png
    ckeditor
        CHANGES.md
        LICENSE.md
        README.md
        adapters
            jquery.js
        build-config.js
        ckeditor.js
        config.js
        contents.css
        lang
            af.js
            ar.js
            bg.js
            bn.js
            bs.js
            ca.js
            cs.js
            cy.js
            da.js
            de.js
            el.js
            en-au.js
            en-ca.js
            en-gb.js
            en.js
            eo.js
            es.js
            et.js
            eu.js
            fa.js
            fi.js
            fo.js
            fr-ca.js
            fr.js
            gl.js
            gu.js
            he.js
            hi.js
            hr.js
            hu.js
            id.js
            is.js
            it.js
            ja.js
            ka.js
            km.js
            ko.js
            ku.js
            lt.js
            lv.js
            mk.js
            mn.js
            ms.js
            nb.js
            nl.js
            no.js
            pl.js
            pt-br.js
            pt.js
            ro.js
            ru.js
            si.js
            sk.js
            sl.js
            sq.js
            sr-latn.js
            sr.js
            sv.js
            th.js
            tr.js
            tt.js
            ug.js
            uk.js
            vi.js
            zh-cn.js
            zh.js
        plugins
            a11yhelp
                dialogs
                    a11yhelp.js
                    lang
                        _translationstatus.txt
                        af.js
                        ar.js
                        bg.js
                        ca.js
                        cs.js
                        cy.js
                        da.js
                        de.js
                        el.js
                        en-gb.js
                        en.js
                        eo.js
                        es.js
                        et.js
                        fa.js
                        fi.js
                        fo.js
                        fr-ca.js
                        fr.js
                        gl.js
                        gu.js
                        he.js
                        hi.js
                        hr.js
                        hu.js
                        id.js
                        it.js
                        ja.js
                        km.js
                        ko.js
                        ku.js
                        lt.js
                        lv.js
                        mk.js
                        mn.js
                        nb.js
                        nl.js
                        no.js
                        pl.js
                        pt-br.js
                        pt.js
                        ro.js
                        ru.js
                        si.js
                        sk.js
                        sl.js
                        sq.js
                        sr-latn.js
                        sr.js
                        sv.js
                        th.js
                        tr.js
                        tt.js
                        ug.js
                        uk.js
                        vi.js
                        zh-cn.js
                        zh.js
            about
                dialogs
                    about.js
                    hidpi
                        logo_ckeditor.png
                    logo_ckeditor.png
            clipboard
                dialogs
                    paste.js
            colordialog
                dialogs
                    colordialog.js
            dialog
                dialogDefinition.js
            div
                dialogs
                    div.js
            find
                dialogs
                    find.js
            flash
                dialogs
                    flash.js
                images
                    placeholder.png
            forms
                dialogs
                    button.js
                    checkbox.js
                    form.js
                    hiddenfield.js
                    radio.js
                    select.js
                    textarea.js
                    textfield.js
                images
                    hiddenfield.gif
            icons.png
            icons_hidpi.png
            iframe
                dialogs
                    iframe.js
                images
                    placeholder.png
            image
                dialogs
                    image.js
                images
                    noimage.png
            link
                dialogs
                    anchor.js
                    link.js
                images
                    anchor.png
                    hidpi
                        anchor.png
            liststyle
                dialogs
                    liststyle.js
            magicline
                images
                    hidpi
                        icon-rtl.png
                        icon.png
                    icon-rtl.png
                    icon.png
            pagebreak
                images
                    pagebreak.gif
            pastefromword
                filter
                    default.js
            preview
                preview.html
            scayt
                LICENSE.md
                README.md
                dialogs
                    options.js
                    toolbar.css
            showblocks
                images
                    block_address.png
                    block_blockquote.png
                    block_div.png
                    block_h1.png
                    block_h2.png
                    block_h3.png
                    block_h4.png
                    block_h5.png
                    block_h6.png
                    block_p.png
                    block_pre.png
            smiley
                dialogs
                    smiley.js
                images
                    angel_smile.gif
                    angel_smile.png
                    angry_smile.gif
                    angry_smile.png
                    broken_heart.gif
                    broken_heart.png
                    confused_smile.gif
                    confused_smile.png
                    cry_smile.gif
                    cry_smile.png
                    devil_smile.gif
                    devil_smile.png
                    embaressed_smile.gif
                    embarrassed_smile.gif
                    embarrassed_smile.png
                    envelope.gif
                    envelope.png
                    heart.gif
                    heart.png
                    kiss.gif
                    kiss.png
                    lightbulb.gif
                    lightbulb.png
                    omg_smile.gif
                    omg_smile.png
                    regular_smile.gif
                    regular_smile.png
                    sad_smile.gif
                    sad_smile.png
                    shades_smile.gif
                    shades_smile.png
                    teeth_smile.gif
                    teeth_smile.png
                    thumbs_down.gif
                    thumbs_down.png
                    thumbs_up.gif
                    thumbs_up.png
                    tongue_smile.gif
                    tongue_smile.png
                    tounge_smile.gif
                    whatchutalkingabout_smile.gif
                    whatchutalkingabout_smile.png
                    wink_smile.gif
                    wink_smile.png
            specialchar
                dialogs
                    lang
                        _translationstatus.txt
                        af.js
                        ar.js
                        bg.js
                        ca.js
                        cs.js
                        cy.js
                        da.js
                        de.js
                        el.js
                        en-gb.js
                        en.js
                        eo.js
                        es.js
                        et.js
                        fa.js
                        fi.js
                        fr-ca.js
                        fr.js
                        gl.js
                        he.js
                        hr.js
                        hu.js
                        id.js
                        it.js
                        ja.js
                        km.js
                        ko.js
                        ku.js
                        lt.js
                        lv.js
                        nb.js
                        nl.js
                        no.js
                        pl.js
                        pt-br.js
                        pt.js
                        ru.js
                        si.js
                        sk.js
                        sl.js
                        sq.js
                        sv.js
                        th.js
                        tr.js
                        tt.js
                        ug.js
                        uk.js
                        vi.js
                        zh-cn.js
                        zh.js
                    specialchar.js
            strinsert
                plugin.js
            table
                dialogs
                    table.js
            tabletools
                dialogs
                    tableCell.js
            templates
                dialogs
                    templates.css
                    templates.js
                templates
                    default.js
                    images
                        template1.gif
                        template2.gif
                        template3.gif
            wsc
                LICENSE.md
                README.md
                dialogs
                    ciframe.html
                    tmpFrameset.html
                    wsc.css
                    wsc.js
                    wsc_ie.js
        samples
            css
                samples.css
            img
                github-top.png
                header-bg.png
                header-separator.png
                logo.png
                navigation-tip.png
            index.html
            js
                sample.js
                sf.js
            old
                ajax.html
                api.html
                appendto.html
                assets
                    inlineall
                        logo.png
                    outputxhtml
                        outputxhtml.css
                    posteddata.php
                    sample.jpg
                    uilanguages
                        languages.js
                datafiltering.html
                dialog
                    assets
                        my_dialog.js
                    dialog.html
                divreplace.html
                enterkey
                    enterkey.html
                htmlwriter
                    assets
                        outputforflash
                            outputforflash.fla
                            outputforflash.swf
                            swfobject.js
                    outputforflash.html
                    outputhtml.html
                index.html
                inlineall.html
                inlinebycode.html
                inlinetextarea.html
                jquery.html
                magicline
                    magicline.html
                readonly.html
                replacebyclass.html
                replacebycode.html
                sample.css
                sample.js
                sample_posteddata.php
                tabindex.html
                toolbar
                    toolbar.html
                uicolor.html
                uilanguages.html
                wysiwygarea
                    fullpage.html
                xhtmlstyle.html
            toolbarconfigurator
                css
                    fontello.css
                font
                    LICENSE.txt
                    config.json
                    fontello.eot
                    fontello.svg
                    fontello.ttf
                    fontello.woff
                index.html
                js
                    abstracttoolbarmodifier.js
                    fulltoolbareditor.js
                    toolbarmodifier.js
                    toolbartextmodifier.js
                lib
                    codemirror
                        LICENSE
                        codemirror.css
                        codemirror.js
                        javascript.js
                        neo.css
                        show-hint.css
                        show-hint.js
        skins
            moono
                dialog.css
                dialog_ie.css
                dialog_ie7.css
                dialog_ie8.css
                dialog_iequirks.css
                editor.css
                editor_gecko.css
                editor_ie.css
                editor_ie7.css
                editor_ie8.css
                editor_iequirks.css
                icons.png
                icons_hidpi.png
                images
                    arrow.png
                    close.png
                    hidpi
                        close.png
                        lock-open.png
                        lock.png
                        refresh.png
                    lock-open.png
                    lock.png
                    refresh.png
                    spinner.gif
                readme.md
            office2013
                dialog.css
                editor.css
                icons.png
                icons_hidpi.png
                images
                    arrow.png
                    close.png
                    hidpi
                        close.png
                        lock-open.png
                        lock.png
                        refresh.png
                    lock-open.png
                    lock.png
                    refresh.png
                skin.js
        styles.js
    crop
        Canvas.php
        Coordinate.php
        Exception.php
        Font
            GDF.php
            PS.php
            TTF.php
        Image.php
        Mapper
            BMP.php
            GD.php
            GD2.php
            GIF.php
            JPEG.php
            PNG.php
            TGA.php
        MapperFactory.php
        Operation
            AddNoise.php
            ApplyConvolution.php
            ApplyFilter.php
            ApplyMask.php
            AsGrayscale.php
            AsNegative.php
            AutoCrop.php
            CopyChannelsPalette.php
            CopyChannelsTrueColor.php
            CorrectGamma.php
            Crop.php
            Flip.php
            GetMask.php
            Merge.php
            Mirror.php
            Resize.php
            ResizeCanvas.php
            Rotate.php
            RoundCorners.php
            Unsharp.php
        OperationFactory.php
        PaletteImage.php
        README
        TrueColorImage.php
        VERSION
        WideImage.php
        gpl.txt
        lgpl.txt
        vendor
            de77
                BMP.php
                TGA.php
    datetimepicker-master
        .gitignore
        MIT-LICENSE.txt
        README.md
        bower.json
        datetimepicker.jquery.json
        index.html
        jquery.datetimepicker.css
        jquery.datetimepicker.js
        jquery.js
        package.json
        screen
            1.png
            2.png
            3.1.png
            3.png
            4.png
            5.png
            6.png
    delete.png
    edit.png
    emailadd.png
    emailedit.png
    export.png
    filemanager
        LICENSE.TXT
        README.md
        changelog.txt
        filemanager
            ajax_calls.php
            config
                .htaccess
                config.php
            css
                style.css
            dialog.php
            execute.php
            force_download.php
            img
                clipboard_apply.png
                clipboard_clear.png
                copy.png
                cut.png
                date.png
                dimension.png
                down.png
                download.png
                duplicate.png
                edit_img.png
                file_edit.png
                glyphicons-halflings-white.png
                glyphicons-halflings.png
                ico
                    ac3.jpg
                    accdb.jpg
                    ade.jpg
                    adp.jpg
                    ai.jpg
                    aiff.jpg
                    avi.jpg
                    bmp.jpg
                    css.jpg
                    csv.jpg
                    default.jpg
                    dmg.jpg
                    doc.jpg
                    docx.jpg
                    favicon.ico
                    fla.jpg
                    flv.jpg
                    folder.png
                    folder_back.png
                    gif.jpg
                    gz.jpg
                    html.jpg
                    iso.jpg
                    jpeg.jpg
                    jpg.jpg
                    log.jpg
                    m4a.jpg
                    mdb.jpg
                    mid.jpg
                    mov.jpg
                    mp3.jpg
                    mp4.jpg
                    mpeg.jpg
                    mpg.jpg
                    odb.jpg
                    odf.jpg
                    odg.jpg
                    odp.jpg
                    ods.jpg
                    odt.jpg
                    ogg.jpg
                    otg.jpg
                    otp.jpg
                    ots.jpg
                    ott.jpg
                    pdf.jpg
                    png.jpg
                    ppt.jpg
                    pptx.jpg
                    psd.jpg
                    rar.jpg
                    rtf.jpg
                    sql.jpg
                    svg.jpg
                    tar.jpg
                    tiff.jpg
                    txt.jpg
                    wav.jpg
                    webm.jpg
                    wma.jpg
                    xhtml.jpg
                    xls.jpg
                    xlsx.jpg
                    xml.jpg
                    zip.jpg
                ico_dark
                    ac3.jpg
                    accdb.jpg
                    ade.jpg
                    adp.jpg
                    ai.jpg
                    aiff.jpg
                    avi.jpg
                    bmp.jpg
                    css.jpg
                    csv.jpg
                    default.jpg
                    dmg.jpg
                    doc.jpg
                    docx.jpg
                    favicon.ico
                    fla.jpg
                    flv.jpg
                    folder.png
                    folder_back.png
                    gif.jpg
                    gz.jpg
                    html.jpg
                    iso.jpg
                    jpeg.jpg
                    jpg.jpg
                    log.jpg
                    m4a.jpg
                    mdb.jpg
                    mid.jpg
                    mov.jpg
                    mp3.jpg
                    mp4.jpg
                    mpeg.jpg
                    mpg.jpg
                    odb.jpg
                    odf.jpg
                    odg.jpg
                    odp.jpg
                    ods.jpg
                    odt.jpg
                    ogg.jpg
                    otg.jpg
                    otp.jpg
                    ots.jpg
                    ott.jpg
                    pdf.jpg
                    png.jpg
                    ppt.jpg
                    pptx.jpg
                    psd.jpg
                    rar.jpg
                    rtf.jpg
                    sql.jpg
                    svg.jpg
                    tar.jpg
                    tiff.jpg
                    txt.jpg
                    wav.jpg
                    webm.jpg
                    wma.jpg
                    xhtml.jpg
                    xls.jpg
                    xlsx.jpg
                    xml.jpg
                    zip.jpg
                info.png
                key.png
                label.png
                loading.gif
                logo.png
                preview.png
                processing.gif
                rename.png
                size.png
                sort.png
                storing_animation.gif
                up.png
                upload.png
                url.png
                zip.png
            include
                Response.php
                mime_type_lib.php
                php_image_magician.php
                utils.php
            js
                ViewerJS
                    AGPL-3.0.txt
                    ODFViewerPlugin.css
                    ODFViewerPlugin.js
                    PDFViewerPlugin.css
                    PDFViewerPlugin.js
                    PluginLoader.js
                    compatibility.js
                    example.local.css
                    images
                        kogmbh.png
                        nlnet.png
                        texture.png
                        toolbarButton-download.png
                        toolbarButton-fullscreen.png
                        toolbarButton-menuArrows.png
                        toolbarButton-pageDown.png
                        toolbarButton-pageUp.png
                        toolbarButton-presentation.png
                        toolbarButton-zoomIn.png
                        toolbarButton-zoomOut.png
                    index.html
                    local.css
                    pdf.js
                    pdf.worker.js
                    pdfjsversion.js
                    text_layer_builder.js
                    ui_utils.js
                    viewer.css
                    viewer.js
                    webodf.js
                ZeroClipboard.swf
                include.js
                jPlayer
                    MIT-LICENSE.txt
                    README.md
                    actionscript
                        Jplayer.as
                        Jplayer.fla
                        happyworm
                            jPlayer
                                ConnectManager.as
                                JplayerEvent.as
                                JplayerMp3.as
                                JplayerMp4.as
                                JplayerRtmp.as
                                JplayerStatus.as
                                TraceOut.as
                    add-on
                        jplayer.playlist.js
                        jquery.jplayer.inspector.js
                    jplayer.jquery.json
                    jquery.jplayer
                        Jplayer.swf
                        jquery.jplayer.js
                    package.json
                    popcorn
                        player
                            popcorn.jplayer.js
                    skin
                        blue.monday
                            jplayer.blue.monday.css
                            jplayer.blue.monday.jpg
                            jplayer.blue.monday.seeking.gif
                            jplayer.blue.monday.video.play.png
                            skin.handlebars
                        pink.flag
                            jplayer.pink.flag.css
                            jplayer.pink.flag.jpg
                            jplayer.pink.flag.seeking.gif
                            jplayer.pink.flag.video.play.png
                modernizr.custom.js
                plugins.js
            lang
                az_AZ.php
                bg_BG.php
                ca.php
                cs.php
                da.php
                de.php
                el_GR.php
                en_EN.php
                es.php
                fa.php
                fr_FR.php
                he_IL.php
                hr.php
                hu_HU.php
                id.php
                it.php
                ja.php
                languages.php
                lt.php
                mn_MN.php
                nb_NO.php
                nl.php
                pl.php
                pt_BR.php
                pt_PT.php
                ru.php
                sk.php
                sl.php
                sv_SE.php
                tr_TR.php
                uk_UA.php
                vi.php
                zh_CN.php
            plugin.min.js
            upload.php
            uploader
                index.php
                jupload.php
                success.jpg
                success.php
                wjhk.jupload.jar
        source
            Chrysanthemum.jpg
            source.txt
        thumbs
            Chrysanthemum.jpg
            thumbs.txt
        tinymce
            plugins
                responsivefilemanager
                    img
                        insertfile.gif
                    plugin.min.js
    habout.png
    haccount.png
    haccountedit.png
    hcopyright.png
    hdraft.png
    heditmessage.png
    hedittime.png
    hemailadd.png
    hemailedit.png
    hexclusion.png
    hexport.png
    hgroup.png
    hgroupedit.png
    himport.png
    hlogin.png
    hlogs.png
    hmainpage.png
    hmessage.png
    hnewmessage.png
    hoptions.png
    hpassword.png
    hprofile.png
    hreport.png
    hsend.png
    hsign.png
    hsignedit.png
    hstats.png
    htime.png
    huseradd.png
    husers.png
    hviewgroup.png
    import.png
    index.html
    jqsimplemenu
        css
            jqsimplemenu.css
        images
            darrow.png
            rarrow.png
        index.html
        js
            jqsimplemenu.js
            jquery-1.4.4.min.js
    jquery-autocomplete
        changelog.txt
        demo
            bg.gif
            emails.php
            emails.phps
            images
                Amsterdam Van-Gogh Museum.jpg
                Amsterdam.jpg
                Antwerpen Rubenshaus.jpg
                Antwerpen.jpg
                Appenzell.jpg
                Arnhem Historisches Museum.jpg
                Bled.jpg
                Bled_Die Burg von Bled.jpg
                Bogojina_Die Pfarrkirche.jpg
                BolognaBasilicadiSanPetronio.jpg
                BolognaFontanadelNettuno.jpg
                BolognaPiazzaMaggiore.jpg
                Bolsward Martinikerk.jpg
                Bolsward Stadhuis.jpg
                Bolsward.jpg
                BordeauxND.jpg
                BordeauxPlaceB.jpg
                BotanischerGartenZuerich.jpg
                Bouillon.jpg
                Gent Hotel de Ville2.jpg
                Gent.jpg
                GenuaStrand.jpg
                GenuabeiNacht.jpg
                Giessbachfaelle Brienz.jpg
                Giethoorn.jpg
                Gnesen.jpg
                Gornij Grad_KATHEDRALE.jpg
                Gossensass.jpg
                Grad_Burg Grad2.jpg
                GrandDixence.jpg
                GrenoblePanorama.jpg
                Groningen.jpg
                GrottenvonReclere.jpg
                Guebwiller.jpg
                Kamnik_Die Franziskaner Bibliothek.jpg
                Karlsbad Muehlbrunnkolonnade.jpg
                Kazimierz.jpg
                KirchbergAltesRathaus1.jpg
                KlagenfurtDom.jpg
                KleineMeerjungfreu.jpg
                LazienkiparkWarschau.jpg
                LeHavreHafen.jpg
                LeMans.jpg
                Lednice.jpg
                Leeuwarden Fries Museum.jpg
                Leeuwarden.jpg
                Lelystad.jpg
                Lemmer.jpg
                Leper Halles aux draps.jpg
                Leuven Museum fuer Kirchenkunst.jpg
                Leuven.jpg
                Luxemburg.jpg
                LuzernAltstadt.jpg
                LuzernPicassoMuseum.jpg
                Lyon.jpg
                Maastricht Onze Lieve Vrou...jpg
                Maastricht St Servaasbasiliek.jpg
                Maastricht Walmuur.jpg
                Maastricht.jpg
                MagiatalMaggia.jpg
                Mailand3.jpg
                Metlika_Bela Krajina Museum.jpg
                MilanoCastelloSforzesco.jpg
                MilanoDom.jpg
                MilazzoBurg.jpg
                Novo Mesto_Das Museum.jpg
                ObervellachBurgFalkenstein.jpg
                OdenseeAndersen.jpg
                Olimje_Kirche und Apotheke in Olimje.jpg
                Olomouc.jpg
                OlympischesMuseumLausanne.jpg
                OrleansMaisonJeannedArc.jpg
                OrleansParcFloraldelaSource.jpg
                OstiaAntica.jpg
                Ostrow Tumski.jpg
                PoertschachSchlossLeonstain.jpg
                Portoroz.jpg
                Posen.jpg
                Postojna.jpg
                Prag Altstaedter Ring.jpg
                Prag Waldsteinpalais.jpg
                RouenNotreDame.jpg
                Salzbergwerk Bex.jpg
                SalzbergwerkWieliczka.jpg
                SalzburgFestungHohensalzburg.jpg
                SalzburgResidenz.jpg
                WienMuseumsQuartier.jpg
                WienMusikverein.jpg
                WienRiesenrad.jpg
                WienRingstrasse.jpg
            images.php
            index.html
            indicator.gif
            json.html
            localdata.js
            main.css
            search.php
            search.phps
        jquery.autocomplete.css
        jquery.autocomplete.js
        jquery.autocomplete.min.js
        jquery.autocomplete.pack.js
        lib
            jquery.ajaxQueue.js
            jquery.bgiframe.min.js
            jquery.js
            thickbox-compressed.js
            thickbox.css
        todo
    jquery-ui
        external
            jquery
                jquery.js
        images
            ui-bg_diagonals-thick_18_b81900_40x40.png
            ui-bg_diagonals-thick_20_666666_40x40.png
            ui-bg_flat_0_aaaaaa_40x100.png
            ui-bg_flat_10_000000_40x100.png
            ui-bg_flat_55_fbec88_40x100.png
            ui-bg_flat_75_ffffff_40x100.png
            ui-bg_glass_100_f6f6f6_1x400.png
            ui-bg_glass_100_fdf5ce_1x400.png
            ui-bg_glass_55_fbf9ee_1x400.png
            ui-bg_glass_65_ffffff_1x400.png
            ui-bg_glass_75_d0e5f5_1x400.png
            ui-bg_glass_75_dadada_1x400.png
            ui-bg_glass_75_e6e6e6_1x400.png
            ui-bg_glass_85_dfeffc_1x400.png
            ui-bg_glass_95_fef1ec_1x400.png
            ui-bg_gloss-wave_35_f6a828_500x100.png
            ui-bg_gloss-wave_55_5c9ccc_500x100.png
            ui-bg_highlight-soft_100_eeeeee_1x100.png
            ui-bg_highlight-soft_75_cccccc_1x100.png
            ui-bg_highlight-soft_75_ffe45c_1x100.png
            ui-bg_inset-hard_100_f5f8f9_1x100.png
            ui-bg_inset-hard_100_fcfdfd_1x100.png
            ui-icons_217bc0_256x240.png
            ui-icons_222222_256x240.png
            ui-icons_228ef1_256x240.png
            ui-icons_2e83ff_256x240.png
            ui-icons_454545_256x240.png
            ui-icons_469bdd_256x240.png
            ui-icons_6da8d5_256x240.png
            ui-icons_888888_256x240.png
            ui-icons_cd0a0a_256x240.png
            ui-icons_d8e7f3_256x240.png
            ui-icons_ef8c08_256x240.png
            ui-icons_f9bd01_256x240.png
            ui-icons_ffd27a_256x240.png
            ui-icons_ffffff_256x240.png
        index.html
        jquery-ui.css
        jquery-ui.js
        jquery-ui.min.css
        jquery-ui.min.js
        jquery-ui.structure.css
        jquery-ui.structure.min.css
        jquery-ui.theme.css
        jquery-ui.theme.min.css
    jquery-ui-sliderAccess.js
    jquery-ui-timepicker-addon.css
    jquery-ui-timepicker-addon.js
    jquery-ui.css
    jquery-ui.min.js
    jquery.min.js
    jscolor
        arrow.gif
        cross.gif
        demo.html
        hs.png
        hv.png
        jscolor.js
    mailIcon.ico
    mailIcon.png
    nodelete.png
    notlogin.png
    report.png
    stats.png
    style.css
    time.png
    user.png
    useradd.png
    view
        bg.png
        bgtop.png
        top1.png
        top2.png
        top3.png
    viewgroup.png
smtpcheck.php
system
    .htaccess
    core
        Benchmark.php
        CodeIgniter.php
        Common.php
        Config.php
        Controller.php
        Exceptions.php
        Hooks.php
        Input.php
        Lang.php
        Loader.php
        Log.php
        Model.php
        Output.php
        Router.php
        Security.php
        URI.php
        Utf8.php
        compat
            hash.php
            index.html
            mbstring.php
            password.php
            standard.php
        index.html
    database
        DB.php
        DB_cache.php
        DB_driver.php
        DB_forge.php
        DB_query_builder.php
        DB_result.php
        DB_utility.php
        drivers
            cubrid
                cubrid_driver.php
                cubrid_forge.php
                cubrid_result.php
                cubrid_utility.php
                index.html
            ibase
                ibase_driver.php
                ibase_forge.php
                ibase_result.php
                ibase_utility.php
                index.html
            index.html
            mssql
                index.html
                mssql_driver.php
                mssql_forge.php
                mssql_result.php
                mssql_utility.php
            mysql
                index.html
                mysql_driver.php
                mysql_forge.php
                mysql_result.php
                mysql_utility.php
            mysqli
                index.html
                mysqli_driver.php
                mysqli_forge.php
                mysqli_result.php
                mysqli_utility.php
            oci8
                index.html
                oci8_driver.php
                oci8_forge.php
                oci8_result.php
                oci8_utility.php
            odbc
                index.html
                odbc_driver.php
                odbc_forge.php
                odbc_result.php
                odbc_utility.php
            pdo
                index.html
                pdo_driver.php
                pdo_forge.php
                pdo_result.php
                pdo_utility.php
                subdrivers
                    index.html
                    pdo_4d_driver.php
                    pdo_4d_forge.php
                    pdo_cubrid_driver.php
                    pdo_cubrid_forge.php
                    pdo_dblib_driver.php
                    pdo_dblib_forge.php
                    pdo_firebird_driver.php
                    pdo_firebird_forge.php
                    pdo_ibm_driver.php
                    pdo_ibm_forge.php
                    pdo_informix_driver.php
                    pdo_informix_forge.php
                    pdo_mysql_driver.php
                    pdo_mysql_forge.php
                    pdo_oci_driver.php
                    pdo_oci_forge.php
                    pdo_odbc_driver.php
                    pdo_odbc_forge.php
                    pdo_pgsql_driver.php
                    pdo_pgsql_forge.php
                    pdo_sqlite_driver.php
                    pdo_sqlite_forge.php
                    pdo_sqlsrv_driver.php
                    pdo_sqlsrv_forge.php
            postgre
                index.html
                postgre_driver.php
                postgre_forge.php
                postgre_result.php
                postgre_utility.php
            sqlite
                index.html
                sqlite_driver.php
                sqlite_forge.php
                sqlite_result.php
                sqlite_utility.php
            sqlite3
                index.html
                sqlite3_driver.php
                sqlite3_forge.php
                sqlite3_result.php
                sqlite3_utility.php
            sqlsrv
                index.html
                sqlsrv_driver.php
                sqlsrv_forge.php
                sqlsrv_result.php
                sqlsrv_utility.php
        index.html
    fonts
        index.html
        texb.ttf
    helpers
        array_helper.php
        captcha_helper.php
        cookie_helper.php
        date_helper.php
        directory_helper.php
        download_helper.php
        email_helper.php
        file_helper.php
        form_helper.php
        html_helper.php
        index.html
        inflector_helper.php
        language_helper.php
        number_helper.php
        path_helper.php
        security_helper.php
        smiley_helper.php
        string_helper.php
        text_helper.php
        typography_helper.php
        url_helper.php
        xml_helper.php
    index.html
    language
        english
            calendar_lang.php
            date_lang.php
            db_lang.php
            email_lang.php
            form_validation_lang.php
            ftp_lang.php
            imglib_lang.php
            index.html
            migration_lang.php
            number_lang.php
            pagination_lang.php
            profiler_lang.php
            unit_test_lang.php
            upload_lang.php
        index.html
    libraries
        Cache
            Cache.php
            drivers
                Cache_apc.php
                Cache_dummy.php
                Cache_file.php
                Cache_memcached.php
                Cache_redis.php
                Cache_wincache.php
                index.html
            index.html
        Calendar.php
        Cart.php
        Driver.php
        Email.php
        Encrypt.php
        Encryption.php
        Form_validation.php
        Ftp.php
        Image_lib.php
        Javascript
            Jquery.php
            index.html
        Javascript.php
        Migration.php
        Pagination.php
        Parser.php
        Profiler.php
        Session
            Session.php
            SessionHandlerInterface.php
            Session_driver.php
            drivers
                Session_database_driver.php
                Session_files_driver.php
                Session_memcached_driver.php
                Session_redis_driver.php
                index.html
            index.html
        Table.php
        Trackback.php
        Typography.php
        Unit_test.php
        Upload.php
        User_agent.php
        Xmlrpc.php
        Xmlrpcs.php
        Zip.php
        index.html
thumbs
    sys.txt
uploads
    sys.txt
<?php
	/**
 * @author Gasper Kozak
 * @copyright 2007-2011

    This file is part of WideImage.
		
    WideImage is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.
		
    WideImage is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
		
    You should have received a copy of the GNU Lesser General Public License
    along with WideImage; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

	* @package WideImage
  **/
	
	/**
	 * Thrown when an invalid dimension is passed for some operations
	 * 
	 * @package Exceptions
	 */
	class WideImage_InvalidImageDimensionException extends WideImage_Exception {}
	
	/**
	 * Thrown when an image can't be saved (returns false by the mapper)
	 * 
	 * @package Exceptions
	 */
	class WideImage_UnknownErrorWhileMappingException extends WideImage_Exception {}
	
	/**
	 * Base class for images
	 * 
	 * @package WideImage
	 */
	abstract class WideImage_Image
	{
		/**
		 * Holds the image resource
		 * @var resource
		 */
		protected $handle = null;
		
		/**
		 * Flag that determines if WideImage should call imagedestroy() upon object destruction
		 * @var bool
		 */
		protected $handleReleased = false;
		
		/**
		 * Canvas object
		 * @var WideImage_Canvas
		 */
		protected $canvas = null;
		
		/**
		 * @var string
		 */
		protected $sdata = null;
		
		/**
		 * The base class constructor
		 *
		 * @param resource $handle Image handle (GD2 resource)
		 */
		function __construct($handle)
		{
			WideImage::assertValidImageHandle($handle);
			$this->handle = $handle;
		}
		
		/**
		 * Cleanup
		 * 
		 * Destroys the handle via WideImage_Image::destroy() when called by the GC.
		 */
		function __destruct()
		{
			$this->destroy();
		}
		
		/**
		 * This method destroy the image handle, and releases the image resource.
		 * 
		 * After this is called, the object doesn't hold a valid image any more.
		 * No operation should be called after that.
		 */
		function destroy()
		{
			if ($this->isValid() && !$this->handleReleased)
				imagedestroy($this->handle);
			
			$this->handle = null;
		}
		
		/**
		 * Returns the GD image resource
		 * 
		 * @return resource GD image resource
		 */
		function getHandle()
		{
			return $this->handle;
		}
		
		/**
		 * @return bool True, if the image object holds a valid GD image, false otherwise
		 */
		function isValid()
		{
			return WideImage::isValidImageHandle($this->handle);
		}
		
		/**
		 * Releases the handle
		 */
		function releaseHandle()
		{
			$this->handleReleased = true;
		}
		
		/**
		 * Saves an image to a file
		 * 
		 * The file type is recognized from the $uri. If you save to a GIF8, truecolor images
		 * are automatically converted to palette.
		 * 
		 * This method supports additional parameters: quality (for jpeg images) and 
		 * compression quality and filters (for png images). See http://www.php.net/imagejpeg and
		 * http://www.php.net/imagepng for details.
		 * 
		 * Examples:
		 * <code>
		 * // save to a GIF
		 * $image->saveToFile('image.gif');
		 * 
		 * // save to a PNG with compression=7 and no filters
		 * $image->saveToFile('image.png', 7, PNG_NO_FILTER);
		 * 
		 * // save to a JPEG with quality=80
		 * $image->saveToFile('image.jpg', 80);
		 * 
		 * // save to a JPEG with default quality=100
		 * $image->saveToFile('image.jpg');
		 * </code>
		 * 
		 * @param string $uri File location
		 */
		function saveToFile($uri)
		{
			$mapper = WideImage_MapperFactory::selectMapper($uri, null);
			$args = func_get_args();
			array_unshift($args, $this->getHandle());
			$res = call_user_func_array(array($mapper, 'save'), $args);
			if (!$res)
				throw new WideImage_UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while saving to $uri");
		}
		
		/**
		 * Returns binary string with image data in format specified by $format
		 * 
		 * Additional parameters may be passed to the function. See WideImage_Image::saveToFile() for more details.
		 * 
		 * @param string $format The format of the image
		 * @return string The binary image data in specified format
		 */
		function asString($format)
		{
			ob_start();
			$args = func_get_args();
			$args[0] = null;
			array_unshift($args, $this->getHandle());
			
			$mapper = WideImage_MapperFactory::selectMapper(null, $format);
			$res = call_user_func_array(array($mapper, 'save'), $args);
			if (!$res)
				throw new WideImage_UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while writing the image data");
			
			return ob_get_clean();
		}
		
		/**
		 * Output a header to browser.
		 * 
		 * @param $name Name of the header
		 * @param $data Data
		 */
		protected function writeHeader($name, $data)
		{
			header($name . ": " . $data);
		}
		
		/**
		 * Outputs the image to browser
		 * 
		 * Sets headers Content-length and Content-type, and echoes the image in the specified format.
		 * All other headers (such as Content-disposition) must be added manually. 
		 * 
		 * Example:
		 * <code>
		 * WideImage::load('image1.png')->resize(100, 100)->output('gif');
		 * </code>
		 * 
		 * @param string $format Image format
		 */
		function output($format)
		{
			$args = func_get_args();
			$data = call_user_func_array(array($this, 'asString'), $args);
			
			$this->writeHeader('Content-length', strlen($data));
			$this->writeHeader('Content-type', WideImage_MapperFactory::mimeType($format));
			echo $data;
		}
		
		/**
		 * @return int Image width
		 */
		function getWidth()
		{
			return imagesx($this->handle);
		}
		
		/**
		 * @return int Image height
		 */
		function getHeight()
		{
			return imagesy($this->handle);
		}
		
		/**
		 * Allocate a color by RGB values.
		 * 
		 * @param mixed $R Red-component value or an RGB array (with red, green, blue keys)
		 * @param int $G If $R is int, this is the green component
		 * @param int $B If $R is int, this is the blue component
		 * @return int Image color index
		 */
		function allocateColor($R, $G = null, $B = null)
		{
			if (is_array($R))
				return imageColorAllocate($this->handle, $R['red'], $R['green'], $R['blue']);
			else
				return imageColorAllocate($this->handle, $R, $G, $B);
		}
		
		/**
		 * @return bool True if the image is transparent, false otherwise
		 */
		function isTransparent()
		{
			return $this->getTransparentColor() >= 0;
		}
		
		/**
		 * @return int Transparent color index
		 */
		function getTransparentColor()
		{
			return imagecolortransparent($this->handle);
		}
		
		/**
		 * Sets the current transparent color index. Only makes sense for palette images (8-bit).
		 * 
		 * @param int $color Transparent color index
		 */
		function setTransparentColor($color)
		{
			return imagecolortransparent($this->handle, $color);
		}
		
		/**
		 * Returns a RGB array of the transparent color or null if none.
		 * 
		 * @return mixed Transparent color RGBA array
		 */
		function getTransparentColorRGB()
		{
			$total = imagecolorstotal($this->handle);
			$tc = $this->getTransparentColor();
			
			if ($tc >= $total && $total > 0)
				return null;
			else
				return $this->getColorRGB($tc);
		}
		
		/**
		 * Returns a RGBA array for pixel at $x, $y
		 * 
		 * @param int $x
		 * @param int $y
		 * @return array RGB array 
		 */
		function getRGBAt($x, $y)
		{
			return $this->getColorRGB($this->getColorAt($x, $y));
		}
		
		/**
		 * Writes a pixel at the designated coordinates
		 * 
		 * Takes an associative array of colours and uses getExactColor() to
		 * retrieve the exact index color to write to the image with.
		 *
		 * @param int $x
		 * @param int $y
		 * @param array $color
		 */
		function setRGBAt($x, $y, $color)
		{
			$this->setColorAt($x, $y, $this->getExactColor($color));
		}
		
		/**
		 * Returns a color's RGB
		 * 
		 * @param int $colorIndex Color index
		 * @return mixed RGBA array for a color with index $colorIndex
		 */
		function getColorRGB($colorIndex)
		{
			return imageColorsForIndex($this->handle, $colorIndex);
		}
		
		/**
		 * Returns an index of the color at $x, $y
		 * 
		 * @param int $x
		 * @param int $y
		 * @return int Color index for a pixel at $x, $y
		 */
		function getColorAt($x, $y)
		{
			return imagecolorat($this->handle, $x, $y);
		}
		
		/**
		 * Set the color index $color to a pixel at $x, $y
		 * 
		 * @param int $x
		 * @param int $y
		 * @param int $color Color index
		 */
		function setColorAt($x, $y, $color)
		{
			return imagesetpixel($this->handle, $x, $y, $color);
		}
		
		/**
		 * Returns closest color index that matches the given RGB value. Uses
		 * PHP's imagecolorclosest()
		 * 
		 * @param mixed $R Red or RGBA array
		 * @param int $G Green component (or null if $R is an RGB array)
		 * @param int $B Blue component (or null if $R is an RGB array)
		 * @return int Color index
		 */
		function getClosestColor($R, $G = null, $B = null)
		{
			if (is_array($R))
				return imagecolorclosest($this->handle, $R['red'], $R['green'], $R['blue']);
			else
				return imagecolorclosest($this->handle, $R, $G, $B);
		}
		
		/**
		 * Returns the color index that exactly matches the given RGB value. Uses
		 * PHP's imagecolorexact()
		 * 
		 * @param mixed $R Red or RGBA array
		 * @param int $G Green component (or null if $R is an RGB array)
		 * @param int $B Blue component (or null if $R is an RGB array)
		 * @return int Color index
		 */
		function getExactColor($R, $G = null, $B = null)
		{
			if (is_array($R))
				return imagecolorexact($this->handle, $R['red'], $R['green'], $R['blue']);
			else
				return imagecolorexact($this->handle, $R, $G, $B);
		}
		
		/**
		 * Copies transparency information from $sourceImage. Optionally fills
		 * the image with the transparent color at (0, 0).
		 * 
		 * @param object $sourceImage
		 * @param bool $fill True if you want to fill the image with transparent color
		 */
		function copyTransparencyFrom($sourceImage, $fill = true)
		{
			if ($sourceImage->isTransparent())
			{
				$rgba = $sourceImage->getTransparentColorRGB();
				if ($rgba === null)
					return;
				
				if ($this->isTrueColor())
				{
					$rgba['alpha'] = 127;
					$color = $this->allocateColorAlpha($rgba);
				}
				else
					$color = $this->allocateColor($rgba);
				
				$this->setTransparentColor($color);
				if ($fill)
					$this->fill(0, 0, $color);
			}
		}
		
		/**
		 * Fill the image at ($x, $y) with color index $color
		 * 
		 * @param int $x
		 * @param int $y
		 * @param int $color
		 */
		function fill($x, $y, $color)
		{
			return imagefill($this->handle, $x, $y, $color);
		}
		
		/**
		 * Used internally to create Operation objects
		 *
		 * @param string $name
		 * @return object
		 */
		protected function getOperation($name)
		{
			return WideImage_OperationFactory::get($name);
		}
		
		/**
		 * Returns the image's mask
		 * 
		 * Mask is a greyscale image where the shade defines the alpha channel (black = transparent, white = opaque).
		 * 
		 * For opaque images (JPEG), the result will be white. For images with single-color transparency (GIF, 8-bit PNG), 
		 * the areas with the transparent color will be black. For images with alpha channel transparenct, 
		 * the result will be alpha channel.
		 * 
		 * @return WideImage_Image An image mask
		 **/
		function getMask()
		{
			return $this->getOperation('GetMask')->execute($this);
		}
		
		/**
		 * Resize the image to given dimensions.
		 * 
		 * $width and $height are both smart coordinates. This means that you can pass any of these values in:
		 *   - positive or negative integer (100, -20, ...)
		 *   - positive or negative percent string (30%, -15%, ...)
		 *   - complex coordinate (50% - 20, 15 + 30%, ...)
		 * 
		 * If $width is null, it's calculated proportionally from $height, and vice versa.
		 * 
		 * Example (resize to half-size):
		 * <code>
		 * $smaller = $image->resize('50%');
		 * 
		 * $smaller = $image->resize('100', '100', 'inside', 'down');
		 * is the same as
		 * $smaller = $image->resizeDown(100, 100, 'inside');
		 * </code>
		 * 
		 * @param mixed $width The new width (smart coordinate), or null.
		 * @param mixed $height The new height (smart coordinate), or null.
		 * @param string $fit 'inside', 'outside', 'fill'
		 * @param string $scale 'down', 'up', 'any'
		 * @return WideImage_Image The resized image
		 */
		function resize($width = null, $height = null, $fit = 'inside', $scale = 'any')
		{
			return $this->getOperation('Resize')->execute($this, $width, $height, $fit, $scale);
		}
		
		/**
		 * Same as WideImage_Image::resize(), but the image is only applied if it is larger then the given dimensions.
		 * Otherwise, the resulting image retains the source's dimensions.
		 * 
		 * @param int $width New width, smart coordinate
		 * @param int $height New height, smart coordinate
		 * @param string $fit 'inside', 'outside', 'fill'
		 * @return WideImage_Image resized image
		 */
		function resizeDown($width = null, $height = null, $fit = 'inside')
		{
			return $this->resize($width, $height, $fit, 'down');
		}
		
		/**
		 * Same as WideImage_Image::resize(), but the image is only applied if it is smaller then the given dimensions.
		 * Otherwise, the resulting image retains the source's dimensions.
		 * 
		 * @param int $width New width, smart coordinate
		 * @param int $height New height, smart coordinate
		 * @param string $fit 'inside', 'outside', 'fill'
		 * @return WideImage_Image resized image
		 */
		function resizeUp($width = null, $height = null, $fit = 'inside')
		{
			return $this->resize($width, $height, $fit, 'up');
		}
		
		/**
		 * Rotate the image for angle $angle clockwise.
		 * 
		 * Preserves transparency. Has issues when saving to a BMP.
		 * 
		 * @param int $angle Angle in degrees, clock-wise
		 * @param int $bgColor color of the new background
		 * @param bool $ignoreTransparent
		 * @return WideImage_Image The rotated image
		 */
		function rotate($angle, $bgColor = null, $ignoreTransparent = true)
		{
			return $this->getOperation('Rotate')->execute($this, $angle, $bgColor, $ignoreTransparent);
		}
		
		/**
		 * This method lays the overlay (watermark) on the image.
		 * 
		 * Hint: if the overlay is a truecolor image with alpha channel, you should leave $pct at 100.
		 * 
		 * This operation supports alignment notation in coordinates:
		 * <code>
		 * $watermark = WideImage::load('logo.gif');
		 * $base = WideImage::load('picture.jpg');
		 * $result = $base->merge($watermark, "right - 10", "bottom - 10", 50);
		 * // applies a logo aligned to bottom-right corner with a 10 pixel margin
		 * </code>
		 * 
		 * @param WideImage_Image $overlay The overlay image
		 * @param mixed $left Left position of the overlay, smart coordinate
		 * @param mixed $top Top position of the overlay, smart coordinate
		 * @param int $pct The opacity of the overlay
		 * @return WideImage_Image The merged image
		 */
		function merge($overlay, $left = 0, $top = 0, $pct = 100)
		{
			return $this->getOperation('Merge')->execute($this, $overlay, $left, $top, $pct);
		}
		
		/**
		 * Resizes the canvas of the image, but doesn't scale the content of the image
		 * 
		 * This operation creates an empty canvas with dimensions $width x $height, filled with 
		 * background color $bg_color and draws the original image onto it at position [$pos_x, $pos_y].
		 * 
		 * Arguments $width, $height, $pos_x and $pos_y are all smart coordinates. $width and $height are 
		 * relative to the current image size, $pos_x and $pos_y are relative to the newly calculated
		 * canvas size. This can be confusing, but it makes sense. See the example below.
		 * 
		 * The example below loads a 100x150 image and then resizes its canvas to 200% x 100%+20 
		 * (which evaluates to 200x170). The image is placed at position [10, center+20], which evaluates to [10, 30].
		 * <code>
		 * $image = WideImage::load('someimage.jpg'); // 100x150
		 * $white = $image->allocateColor(255, 255, 255);
		 * $image->resizeCanvas('200%', '100% + 20', 10, 'center+20', $white);
		 * </code>
		 * 
		 * The parameter $merge defines whether the original image should be merged onto the new canvas.
		 * This means it blends transparent color and alpha colors into the background color. If set to false,
		 * the original image is just copied over, preserving the transparency/alpha information.
		 * 
		 * You can set the $scale parameter to limit when to resize the canvas. For example, if you want 
		 * to resize the canvas only if the image is smaller than the new size, but leave the image intact 
		 * if it's larger, set it to 'up'. Likewise, if you want to shrink the canvas, but don't want to 
		 * change images that are already smaller, set it to 'down'. 
		 * 
		 * @param mixed $width Width of the new canvas (smart coordinate, relative to current image width)
		 * @param mixed $height Height of the new canvas (smart coordinate, relative to current image height)
		 * @param mixed $pos_x x-position of the image (smart coordinate, relative to the new width)
		 * @param mixed $pos_y y-position of the image (smart coordinate, relative to the new height)
		 * @param int $bg_color Background color (created with allocateColor or allocateColorAlpha), defaults to null (tries to use a transparent color)
		 * @param string $scale Possible values: 'up' (enlarge only), 'down' (downsize only), 'any' (resize precisely to $width x $height). Defaults to 'any'.
		 * @param bool $merge Merge the original image (flatten alpha channel and transparency) or copy it over (preserve). Defaults to false.
		 * @return WideImage_Image The resulting image with resized canvas
		 */
		function resizeCanvas($width, $height, $pos_x, $pos_y, $bg_color = null, $scale = 'any', $merge = false)
		{
			return $this->getOperation('ResizeCanvas')->execute($this, $width, $height, $pos_x, $pos_y, $bg_color, $scale, $merge);
		}
		
		/**
		 * Returns an image with round corners
		 * 
		 * You can either set the corners' color or set them transparent.
		 * 
		 * Note on $smoothness: 1 means jagged edges, 2 is much better, more than 4 doesn't noticeably improve the quality.
		 * Rendering becomes increasingly slower if you increase smoothness.
		 * 
		 * Example:
		 * <code>
		 * $nice = $ugly->roundCorners(20, $ugly->allocateColor(255, 0, 0), 2);
		 * </code>
		 * 
		 * Use $corners parameter to specify which corners to draw rounded. Possible values are
		 * WideImage::SIDE_TOP_LEFT, WideImage::SIDE_TOP,
		 * WideImage::SIDE_TOP_RIGHT, WideImage::SIDE_RIGHT,
		 * WideImage::SIDE_BOTTOM_RIGHT, WideImage::SIDE_BOTTOM, 
		 * WideImage::SIDE_BOTTOM_LEFT, WideImage::SIDE_LEFT, and WideImage::SIDE_ALL.
		 * You can specify any combination of corners with a + operation, see example below.
		 * 
		 * Example:
		 * <code>
		 * $white = $image->allocateColor(255, 255, 255);
		 * $diagonal_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_TOP_LEFT + WideImage::SIDE_BOTTOM_RIGHT);
		 * $right_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_RIGHT);
		 * </code>
		 * 
		 * @param int $radius Radius of the corners
		 * @param int $color The color of corners. If null, corners are rendered transparent (slower than using a solid color).
		 * @param int $smoothness Specify the level of smoothness. Suggested values from 1 to 4.
		 * @param int $corners Specify which corners to draw (defaults to WideImage::SIDE_ALL = all corners)
		 * @return WideImage_Image The resulting image with round corners
		 */
		function roundCorners($radius, $color = null, $smoothness = 2, $corners = 255)
		{
			return $this->getOperation('RoundCorners')->execute($this, $radius, $color, $smoothness, $corners);
		}
		
		/**
		 * Returns an image with applied mask
		 * 
		 * A mask is a grayscale image, where the shade determines the alpha channel. Black is fully transparent
		 * and white is fully opaque.
		 * 
		 * @param WideImage_Image $mask The mask image, greyscale
		 * @param mixed $left Left coordinate, smart coordinate
		 * @param mixed $top Top coordinate, smart coordinate
		 * @return WideImage_Image The resulting image
		 **/
		function applyMask($mask, $left = 0, $top = 0)
		{
			return $this->getOperation('ApplyMask')->execute($this, $mask, $left, $top);
		}
		
		/**
		 * Applies a filter
		 *
		 * @param int $filter One of the IMG_FILTER_* constants
		 * @param int $arg1
		 * @param int $arg2
		 * @param int $arg3
		 * @param int $arg4
		 * @return WideImage_Image
		 */
		function applyFilter($filter, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null)
		{
			return $this->getOperation('ApplyFilter')->execute($this, $filter, $arg1, $arg2, $arg3, $arg4);
		}
		
		/**
		 * Applies convolution matrix with imageconvolution()
		 *
		 * @param array $matrix
		 * @param float $div
		 * @param float $offset
		 * @return WideImage_Image
		 */
		function applyConvolution($matrix, $div, $offset)
		{
			return $this->getOperation('ApplyConvolution')->execute($this, $matrix, $div, $offset);
		}
		
		/**
		 * Returns a cropped rectangular portion of the image
		 * 
		 * If the rectangle specifies area that is out of bounds, it's limited to the current image bounds.
		 * 
		 * Examples:
		 * <code>
		 * $cropped = $img->crop(10, 10, 150, 200); // crops a 150x200 rect at (10, 10)
		 * $cropped = $img->crop(-100, -50, 100, 50); // crops a 100x50 rect at the right-bottom of the image
		 * $cropped = $img->crop('25%', '25%', '50%', '50%'); // crops a 50%x50% rect from the center of the image
		 * </code>
		 * 
		 * This operation supports alignment notation in left/top coordinates.
		 * Example:
		 * <code>
		 * $cropped = $img->crop("right", "bottom", 100, 200); // crops a 100x200 rect from right bottom
		 * $cropped = $img->crop("center", "middle", 50, 30); // crops a 50x30 from the center of the image
		 * </code>
		 * 
		 * @param mixed $left Left-coordinate of the crop rect, smart coordinate
		 * @param mixed $top Top-coordinate of the crop rect, smart coordinate
		 * @param mixed $width Width of the crop rect, smart coordinate
		 * @param mixed $height Height of the crop rect, smart coordinate
		 * @return WideImage_Image The cropped image
		 **/
		function crop($left = 0, $top = 0, $width = '100%', $height = '100%')
		{
			return $this->getOperation('Crop')->execute($this, $left, $top, $width, $height);
		}
		
		/**
		 * Performs an auto-crop on the image
		 *
		 * The image is auto-cropped from each of four sides. All sides are 
		 * scanned for pixels that differ from $base_color for more than 
		 * $rgb_threshold in absolute RGB difference. If more than $pixel_cutoff 
		 * differentiating pixels are found, that line is considered to be the crop line for the side.
		 * If the line isn't different enough, the algorithm procedes to the next line 
		 * towards the other edge of the image.
		 * 
		 * When the crop rectangle is found, it's enlarged by the $margin value on each of the four sides.
		 *
		 * @param int $margin Margin for the crop rectangle, can be negative.
		 * @param int $rgb_threshold RGB difference which still counts as "same color".
		 * @param int $pixel_cutoff How many pixels need to be different to mark a cut line.
		 * @param int $base_color The base color index. If none specified (or null given), left-top pixel is used.
		 * @return WideImage_Image The cropped image
		 */
		function autoCrop($margin = 0, $rgb_threshold = 0, $pixel_cutoff = 1, $base_color = null)
		{
			return $this->getOperation('AutoCrop')->execute($this, $margin, $rgb_threshold, $pixel_cutoff, $base_color);
		}
		
		/**
		 * Returns a negative of the image
		 *
		 * This operation differs from calling WideImage_Image::applyFilter(IMG_FILTER_NEGATIVE), because it's 8-bit and transparency safe.
		 * This means it will return an 8-bit image, if the source image is 8-bit. If that 8-bit image has a palette transparency,
		 * the resulting image will keep transparency.
		 *
		 * @return WideImage_Image negative of the image
		 */
		function asNegative()
		{
			return $this->getOperation('AsNegative')->execute($this);
		}
		
		/**
		 * Returns a grayscale copy of the image
		 * 
		 * @return WideImage_Image grayscale copy
		 **/
		function asGrayscale()
		{
			return $this->getOperation('AsGrayscale')->execute($this);
		}
		
		/**
		 * Returns a mirrored copy of the image
		 * 
		 * @return WideImage_Image Mirrored copy
		 **/
		function mirror()
		{
			return $this->getOperation('Mirror')->execute($this);
		}
		
		/**
		 * Applies the unsharp filter
		 * 
		 * @param float $amount
		 * @param float $radius
		 * @param float $threshold
		 * @return WideImage_Image Unsharpened copy of the image
		 **/
		function unsharp($amount, $radius, $threshold)
		{
			return $this->getOperation('Unsharp')->execute($this, $amount, $radius, $threshold);
		}
		
		/**
		 * Returns a flipped (mirrored over horizontal line) copy of the image
		 * 
		 * @return WideImage_Image Flipped copy
		 **/
		function flip()
		{
			return $this->getOperation('Flip')->execute($this);
		}
		
		/**
		 * Corrects gamma on the image
		 * 
		 * @param float $inputGamma
		 * @param float $outputGamma
		 * @return WideImage_Image Image with corrected gamma
		 **/
		function correctGamma($inputGamma, $outputGamma)
		{
			return $this->getOperation('CorrectGamma')->execute($this, $inputGamma, $outputGamma);
		}
		
		/**
		 * Adds noise to the image
		 * 
		 * @author Tomasz Kapusta
		 * 
		 * @param int $amount Number of noise pixels to add
		 * @param string $type Type of noise 'salt&pepper', 'color' or 'mono'
		 * @return WideImage_Image Image with noise added
		 **/
		function addNoise($amount, $type)
		{
			return $this->getOperation('AddNoise')->execute($this, $amount, $type);
		}
		
		/**
		 * Used internally to execute operations
		 *
		 * @param string $name
		 * @param array $args
		 * @return WideImage_Image
		 */
		function __call($name, $args)
		{
			$op = $this->getOperation($name);
			array_unshift($args, $this);
			return call_user_func_array(array($op, 'execute'), $args);
		}
		
		/**
		 * Returns an image in GIF or PNG format
		 *
		 * @return string
		 */
		function __toString()
		{
			if ($this->isTransparent())
				return $this->asString('gif');
			else
				return $this->asString('png');
		}
		
		/**
		 * Returns a copy of the image object
		 * 
		 * @return WideImage_Image The copy
		 **/
		function copy()
		{
			$dest = $this->doCreate($this->getWidth(), $this->getHeight());
			$dest->copyTransparencyFrom($this, true);
			$this->copyTo($dest, 0, 0);
			return $dest;
		}
		
		/**
		 * Copies this image onto another image
		 * 
		 * @param WideImage_Image $dest
		 * @param int $left
		 * @param int $top
		 **/
		function copyTo($dest, $left = 0, $top = 0)
		{
			if (!imagecopy($dest->getHandle(), $this->handle, $left, $top, 0, 0, $this->getWidth(), $this->getHeight()))
				throw new WideImage_GDFunctionResultException("imagecopy() returned false");
		}
		
		/**
		 * Returns the canvas object
		 * 
		 * The Canvas object can be used to draw text and shapes on the image
		 * 
		 * Examples:
		 * <code>
		 * $img = WideImage::load('pic.jpg);
		 * $canvas = $img->getCanvas();
		 * $canvas->useFont('arial.ttf', 15, $img->allocateColor(200, 220, 255));
		 * $canvas->writeText(10, 50, "Hello world!");
		 * 
		 * $canvas->filledRectangle(10, 10, 80, 40, $img->allocateColor(255, 127, 255));
		 * $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0));
		 * $img->saveToFile('new.png');
		 * </code>
		 * 
		 * @return WideImage_Canvas The Canvas object
		 **/
		function getCanvas()
		{
			if ($this->canvas == null)
				$this->canvas = new WideImage_Canvas($this);
			return $this->canvas;
		}
		
		/**
		 * Returns true if the image is true-color, false otherwise
		 * 
		 * @return bool
		 **/
		abstract function isTrueColor();
		
		/**
		 * Returns a true-color copy of the image
		 * 
		 * @return WideImage_TrueColorImage
		 **/
		abstract function asTrueColor();
		
		/**
		 * Returns a palette copy (8bit) of the image
		 *
		 * @param int $nColors Number of colors in the resulting image, more than 0, less or equal to 255
		 * @param bool $dither Use dithering or not
		 * @param bool $matchPalette Set to true to use imagecolormatch() to match the resulting palette more closely to the original image 
		 * @return WideImage_Image
		 **/
		abstract function asPalette($nColors = 255, $dither = null, $matchPalette = true);
		
		/**
		 * Retrieve an image with selected channels
		 * 
		 * Examples:
		 * <code>
		 * $channels = $img->getChannels('red', 'blue');
		 * $channels = $img->getChannels('alpha', 'green');
		 * $channels = $img->getChannels(array('green', 'blue'));
		 * </code>
		 * 
		 * @return WideImage_Image
		 **/
		abstract function getChannels();
		
		/**
		 * Returns an image without an alpha channel
		 * 
		 * @return WideImage_Image
		 **/
		abstract function copyNoAlpha();
		
		/**
		 * Returns an array of serializable protected variables. Called automatically upon serialize().
		 * 
		 * @return array
		 */
		function __sleep()
		{
			$this->sdata = $this->asString('png');
			return array('sdata', 'handleReleased');
		}
		
		/**
		 * Restores an image from serialization. Called automatically upon unserialize().
		 */
		function __wakeup()
		{
			$temp_image = WideImage::loadFromString($this->sdata);
			$temp_image->releaseHandle();
			$this->handle = $temp_image->handle;
			$temp_image = null;
			$this->sdata = null;
		}
	}