| 662 | | my $thumbnail_link; |
|---|
| 663 | | $thumbnail_link = $new_url . 'thumbnail.gif'; |
|---|
| 664 | | my $thumbnail_large_link; |
|---|
| 665 | | $thumbnail_large_link = $new_url . 'thumbnail-large.gif'; |
|---|
| | 662 | my %thumbnails; |
|---|
| | 663 | THUMB: for my $thumb (qw( thumbnail thumbnail_large )) { |
|---|
| | 664 | $thumbnails{$thumb} = $metadata{$thumb}; |
|---|
| | 665 | next THUMB if $thumbnails{$thumb}; |
|---|
| | 666 | |
|---|
| | 667 | my $thumb_filename = $thumb; |
|---|
| | 668 | $thumb_filename =~ tr/_/-/; |
|---|
| | 669 | $thumb_filename .= '.gif'; |
|---|
| | 670 | |
|---|
| | 671 | if ($url_is_web) { |
|---|
| | 672 | my $thumb_url = $new_url . $thumb_filename; |
|---|
| | 673 | |
|---|
| | 674 | my $user_agent = $app->new_ua; |
|---|
| | 675 | my $css_request = HTTP::Request->new( HEAD => $thumb_url ); |
|---|
| | 676 | my $response = $user_agent->request($css_request); |
|---|
| | 677 | if ($response->is_success()) { |
|---|
| | 678 | $thumbnails{$thumb} = $thumb_url; |
|---|
| | 679 | } |
|---|
| | 680 | } |
|---|
| | 681 | else { |
|---|
| | 682 | my $thumb_path = File::Spec->catfile($themeroot, |
|---|
| | 683 | $thumb_filename); |
|---|
| | 684 | if (-e $thumb_path) { |
|---|
| | 685 | $thumbnails{$thumb} = $new_url . $thumb_filename; |
|---|
| | 686 | } |
|---|
| | 687 | } |
|---|
| | 688 | |
|---|
| | 689 | $thumbnails{$thumb} ||= $app->static_path . 'plugins/StyleCatcher/' |
|---|
| | 690 | . 'images/' . $thumb_filename; |
|---|
| | 691 | } |
|---|