Skip to content

Instantly share code, notes, and snippets.

@scottwalters
Created July 28, 2010 19:55
Show Gist options
  • Save scottwalters/496027 to your computer and use it in GitHub Desktop.
Save scottwalters/496027 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
#use Enbugger;
#use Devel::Trace;
#BEGIN { $Devel::Trace::TRACE = 0; };
# $Devel::Trace::TRACE = 1;
use lib '/data/WebGUI/lib';
use lib '/data/WebGUI/t/lib';
use WebGUI::Test;
use WebGUI::Session;
use WebGUI::User;
use WebGUI::Asset;
use Data::Dumper;
my $session = WebGUI::Test->session;
$session->user( { userId => 3 } ); # become root
my $assetId = shift @ARGV or die;
my $asset = WebGUI::Asset->new($session, $assetId) or die "can't find asset for ``$assetId''";
#
#
my $assets = $asset->getLineage(['descendants'], { returnObjects => 1, } );
for my $asset (@$assets) {
# print $asset->getId, ' ', $asset->get('title'), ' ', ref $asset, "\n";
if($asset->isa('WebGUI::Asset::File::GalleryFile::Photo')) {
# blurp($asset);
if( $asset->get('filename') and $asset->can('getStorageLocation') and $asset->getStorageLocation->getPath($asset->get('filename')) ) {
my $file = $asset->getStorageLocation->getPath($asset->get('filename'));
print $file, -f $file ? ' exists' : ' does NOT exist', "\n";
# -f $file or do { 0 and warn "oops, that file ``$file'' isn't there; skipping"; next; };
# warn "okay, going ahead with generateThumbnail on ``$file''...";
# $asset->generateThumbnail(); # XXX
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment