Not sure of the answer, but just to try and put a couple of pieces
together...the
require DynaLoader <https://metacpan.org/module/DynaLoader/source>;
@ISA = qw(Exporter DynaLoader);
bootstrap Image::Imlib2 $VERSION;
lines will probably do this, and hence it will look and find the .xs file
you've found...
and as you've seen...
if (err == IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT) {
Perl_croak(aTHX_ "Image::Imlib2 load error: No loader for
file format");
}
so IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT feels like it's the key bit...
Now, was Imlib2 custom compiled or installed as part of your o.s packages ?
I'm guessing it's definitely installed, but worth checking...
I can see some references to IMLIB2_LOADER_PATH when I look online, but not
sure that will help...
First question though maybe. What has changed recently ?
Ian
On Fri, Mar 28, 2025 at 2:04 PM Ruben Safir <[email protected]> wrote:
> I have an old image gallery that uses this libary in apache2 and modperl
>
> I made a small test program is it behaves like the server code
>
> #!/usr/bin/perl
> use warnings;
>
> use Image::Imlib2;
> my $image;
> #my $pic =
> qq(/usr/local/apache2/htdocs/images/2025_purim_amsterdam/DSC03652.JPG);
> my $pic = qq(/home/ruben/20130303_133505.jpg);
> if (-e $pic) {
> print STDERR "File Exists ==> $pic\n";
> $image = Image::Imlib2->load($pic);
> }
> $image->save("/home/ruben/out.jpg");
>
> [ruben@www3 Image]$ ~/bin/testimlib.pl
> File Exists ==> /home/ruben/20130303_133505.jpg
> Image::Imlib2 load error: No loader for file format at
> /home/ruben/bin/testimlib.pl line 10.
>
> the load() method seems to no longer recognize the file types to decode
> them. It is very fustrating. I looked at the code in
>
>
> /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux-thread-multi/Image/Imlib2.pm
>
> I can't even see the method load or where it might be inherited from
>
> package Image::Imlib2;
>
> use strict;
> use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
>
> require Exporter;
> require DynaLoader;
>
> @ISA = qw(Exporter DynaLoader);
>
> # Items to export into callers namespace by default. Note: do not export
> # names by default without a very good reason. Use EXPORT_OK instead.
> # Do not simply export all your public functions/methods/constants.
> @EXPORT = qw(
> TEXT_TO_RIGHT
> TEXT_TO_LEFT
> TEXT_TO_UP
> TEXT_TO_DOWN
> TEXT_TO_ANGLE
> );
> $VERSION = '2.03';
>
> bootstrap Image::Imlib2 $VERSION;
>
> Image::Imlib2->set_cache_size(0);
>
> sub new_transparent {
> my ( $pkg, $x, $y ) = @_;
> my $pixel = pack( 'CCCC', 0, 0, 0, 0 ); # ARGB
> return Image::Imlib2->new_using_data( $x, $y, $pixel x ( $x * $y ) );
> }
>
> sub new_using_data {
> my ( $pkg, $x, $y, $data ) = @_;
> if ( defined $data && 4 * $x * $y == length $data ) {
> return $pkg->_new_using_data( $x, $y, $data );
> } else {
> return undef;
> }
> }
>
> sub autocrop {
> my $image = shift;
> my ( $x, $y, $w, $h ) = $image->autocrop_dimensions;
> return $image->crop( $x, $y, $w, $h );
> }
>
> 1;
>
>
>
> It is not that large really.
>
> I do find it in the source code for the module in the C library
>
> [ruben@www3 Image]$ pwd
> /home/ruben/.cpan/build/Image-Imlib2-2.03-6/lib/Image
> [ruben@www3 Image]$
> [ruben@www3 Image]$ grep load ./*
> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load); /* prototype to pass
> -Wmissing-prototypes */
> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load)
> ./Imlib2.c: image = imlib_load_image_with_error_return
> (filename, &err);
> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error:
> File does not exist");
> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error:
> File is directory");
> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error:
> Permission denied");
> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error:
> No loader for file format");
> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load_font); /* prototype to pass
> -Wmissing-prototypes */
> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load_font)
> ./Imlib2.c: "Image::Imlib2::load_font",
> ./Imlib2.c: font = imlib_load_font(fontname);
> ./Imlib2.c: (void)newXSproto_portable("Image::Imlib2::load",
> XS_Image__Imlib2_load, file, "$$");
> ./Imlib2.c: (void)newXSproto_portable("Image::Imlib2::load_font",
> XS_Image__Imlib2_load_font, file,
>
> I really need to fix this :(
>
> I would appreciate any help I can get. I never put a C program in perl
> code I don't even see how it inherited the load method or any
> constructor for image types.
>
>
> Seems in some source it has this ==>
> CODE:
> {
> Imlib_Image image;
> Imlib_Load_Error err;
>
> image = imlib_load_image_with_error_return (filename,
> &err);
> if (err == IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST) {
> Perl_croak(aTHX_ "Image::Imlib2 load error: File does
> not exist");
> }
>
> if (err == IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY) {
> Perl_croak(aTHX_ "Image::Imlib2 load error: File is
> directory");
> }
>
> if (err == IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ) {
> Perl_croak(aTHX_ "Image::Imlib2 load error: Permission
> denied");
> }
>
> if (err == IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT) {
> Perl_croak(aTHX_ "Image::Imlib2 load error: No loader
> for file format");
> }
> RETVAL = image;
> }
>
>
> https://metacpan.org/release/LBROCARD/Image-Imlib2-2.03/source/lib/Image/Imlib2.xs#L156
>
>
> Not sure how this is even called by the module. It is not an ISA
>
> this line seems to be the black hole for me
> image = imlib_load_image_with_error_return (filename, &err);
>
> --
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
>
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.brooklyn-living.com
>
> Being so tracked is for FARM ANIMALS and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
>