Daizu

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

        'Path::Class' => '0.02',
        'SVN::Ra' => '0',
        'Template' => '2.15',
        'URI' => '0',
        'XML::LibXML' => '1.59',
    },
    build_requires => {
        'Module::Build' => '0',
    },
    recommends => {
        'Image::Magick' => '0',
        'Template::Plugin::Class' => '0',
        'Text::VimColor' => '0.09',
    },
    dynamic_config => 0,

    script_files => [qw[ bin/daizu ]],
    extra_files => {
        'lib/Daizu/pod/module-links.txt' => 'lib/Daizu/pod/module-links.txt',
        'lib/Daizu/template/article_extras.tt' => 'lib/Daizu/template/article_extras.tt',
        'lib/Daizu/template/article_meta.tt' => 'lib/Daizu/template/article_meta.tt',

META.yml  view on Meta::CPAN

    Module::Build: 0

optional_features:
    - syntax-highlight:
        description: Automatically syntax-highlight example code in articles
        requires:
            Text::VimColor: 0.09
    - picture-article:
        description: Publish pictures as articles, with automatic thumbnails
        requires:
            Image::Magick: 0
    - related-links:
        description: Add a Related Links box to pages for articles
        requires:
            Template::Plugin::Class: 0

no_index:
    file:
        - test-repos.dump

dynamic_config: 0

lib/Daizu/Gen.pm  view on Meta::CPAN

            and die 'error closing compressed sitemap file: ' . $gz->gzerror;
        $url->{fh} = undef;     # don't try to close it again later
    }
}


=item $gen-E<gt>scaled_image($file, $urls)

A standard generator method which generates a scaled version of an image
file.  C<$file> must represent an image in a format which can be understood
by L<Image::Magick>, unless the GUID ID value is included in the argument,
in which case there must be a file with that GUID ID in the working copy which
is of an appropriate type.

The argument should consist of two or three numbers: the desired width and
height of the resulting image, and optionally the GUID ID of the image file
if it isn't the file the URL is actually generated from.  These should be
separated by single spaces.

=cut

lib/Daizu/Gen.pm  view on Meta::CPAN

            my $img_file_id = db_row_id($self->{cms}{db}, 'wc_file',
                wc_id => $file->{wc_id},
                guid_id => $img_guid_id,
            );
            die "image file with GUID ID $img_guid_id not in working copy"
                unless defined $img_file_id;
            $img_file = Daizu::File->new($self->{cms}, $img_file_id);
        }
        my $data = $img_file->data;

        require Image::Magick;
        my $img = Image::Magick->new;
        $img->BlobToImage($$data);

        # Discard all but the first frame, in case it's an animated GIF,
        # otherwise we'll end up with multiple output files.
        $#$img = 0;

        $img->Thumbnail(width => $width, height => $height);

        # TODO: This atrocity is only temporary, until I work out how to
        # tell ImageMagick to write to a bloody file handle.  What the



( run in 0.393 second using v1.01-cache-2.11-cpan-beeb90c9504 )