
bret at pectopah
Apr 10, 2011, 1:19 PM
Post #10 of 10
(727 views)
Permalink
|
|
Re: find_or_create_alternate just returns the original image
[In reply to]
|
|
Hi everybody, I just figured this out. The inital media document had a mixed-case filename, but a lowercase URI format. So the regex that was trying to change the initial image's URI into the thumbnail's URI was failing to find the filename, which left the "target" URI the same as the starter one. Then the lookup found the image with the desired URI and returned the inital picture. I've committed a patch and sent a pull request. Cheers, Bret On Sun, 2011-04-10 at 19:51 +0200, Rolf Schaufelberger wrote: > Hi, > > I just started using this function two days ago and it works fine. > May be something wrong with $element_names_and_sizes{$size} ? > > Am 09.04.2011 um 19:18 schrieb Bret Dawson: > > > Hi David, > > > >> Is $pic a auto_generated_image already? > > > > No, it's just an "image". Do they need to be the same type? > > > > > > Thanks, > > > > Bret > > > > > > > > On Sat, 2011-04-09 at 09:06 -0700, David E. Wheeler wrote: > >> On Apr 8, 2011, at 3:10 PM, Bret Dawson wrote: > >> > >>> Hi everybody, > >>> > >>> I'm just starting to use the find_or_create_alternate() method to make > >>> thumbnails, and I must be doing something wrong. When I try something > >>> like this: > >>> > >>> my $size = 240; > >>> my $thumb = $pic->find_or_create_alternate({ > >>> title_prefix => '', > >>> title_suffix => '-' . $size, > >>> file_suffix => '_sized_nicely, > >>> et_key_name => 'auto_generated_image', > >>> relate => 0, > >>> transformer => sub { > >>> shift->scale( xpixels => $element_names_and_sizes{$size} ); > >>> }, > >>> }); > >>> > >>> ...no new media document is created, and the $thumb returned is the > >>> original $pic. Any idea what I'm doing incorrectly? > >> > > > >> > >> Best, > >> > >> David > >> > >> > > > > -- > > Bret Dawson > > Producer > > Pectopah Productions Inc. > > (416) 895-7635 > > bret [at] pectopah > > www.pectopah.com > > > > Mit freundlichen Grüßen > Rolf Schaufelberger > Geschäftsführer > > plusW GmbH > Vorstadtstr. 61 -67 Tel. 07181 47 47 305 > 73614 Schorndorf Fax. 07181 47 45 344 > > www.plusw.de > www.mypixler.com > www.calendrino.de > > > > > > > -- Bret Dawson Producer Pectopah Productions Inc. (416) 895-7635 bret [at] pectopah www.pectopah.com
|