Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path::Tiny objects do not stringify as path for Image::Scale #6

Closed
wanradt opened this issue Apr 13, 2016 · 1 comment
Closed

Path::Tiny objects do not stringify as path for Image::Scale #6

wanradt opened this issue Apr 13, 2016 · 1 comment

Comments

@wanradt
Copy link

wanradt commented Apr 13, 2016

Hi!

I was really confused when I had problem with putting together Path::Tiny with I::S, so here is little testcase, which demos the problem:

#!/usr/bin/env perl

use strict; use warnings; use 5.018; 
use Path::Tiny; 
use Image::Scale;

my $jpeg_path = path( $ARGV[0] )
  or die "JPEG mandatory\n";

my $png_path = path( 'img.png' );

warn "we have path $png_path!\n";

my $img = Image::Scale->new( $jpeg_path );
$img->resize_gd( { width => '100', keep_aspect => 1 } );
$img->save_png( $png_path );

It gives me output:

we have path img.png!
Image::Scale->save_jpeg requires a path at simple_image_scale_example.pl line 16.

If I use some stringification, it will work, like:

$img->save_png( "$png_path" );

As the save_png seems to reside inside XS-code, it appears that automatic stringification of Path::Tiny object does not work here. Or is it quite a Path::Tiny's issue?

Also, I noticed a typo on line 249 in xs-file:
https://github.com/andygrundman/Image-Scale/blob/master/Scale.xs#L249

There croak should say save_png instead of save_jpeg.

@andygrundman
Copy link
Owner

Thanks for the report. The reason this error occurs is probably because those XS methods are expecting a char * when it should really be an SV (or have a pure-Perl wrapper method). I'll get this fixed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants