<%args> $id => undef $display_set => 'eng' $image_id => undef

% if (@movie_relations) { % foreach my $movie_relation (@movie_relations) % { <% $movie_relation->{"title_$display_set"} %> (<% $movie_relation->{year_made} %>)

%} %} %if($person_image->{"description_$display_set"} ){ <% $person_image->{"description_$display_set"} %>
% } % if ($person_image->{"upload_user"}){ (Image uploaded by <% $person_image->{"upload_user"} %>) % if ($person_image->{"upload_user"} eq 'abbot'){

All of <% $person_image->{"upload_user"} %>'s Exclusive Images
% } % }

 
<%init> ### Check for errors # This'll be passed to /db/common/error.mhtml if # required args are missing my @missing_args; # Required args push(@missing_args, 'id') unless ($id); push(@missing_args, 'display_set') unless ($display_set); # Call error.mhtml if we're missing something if (@missing_args) { $m->comp('/db/common/error.mhtml', errors => [ { description => 'Missing arguments', args => \@missing_args } ], display_set => $display_set ); } my $db = new HKMDB::Database; # Get image info my $person_image = $db->select( table => 'images', select => [ 'path', "description_$display_set", 'height', 'upload_user', 'width' ], keys => [ $image_id ] ); my $resource_stmt = q{ SELECT id FROM resources WHERE table_name = 'images' AND table_id = ? }; my $resource_id = $db->select_column( sql => $resource_stmt, bind => [ $image_id ] ); my $movie_relations_stmt = qq{ SELECT m.id,m.title_$display_set,m.year_made FROM movies as m, movie_resources as mr WHERE mr.resource_id = ? AND m.id = mr.movie_id }; my @movie_relations = $db->select_rows( sql => $movie_relations_stmt, bind => [ $resource_id ], hashref => 1 ); my $people_relations_stmt = qq{ SELECT p.id,p.name_$display_set FROM people as p, people_resources as pr WHERE pr.resource_id = ? AND p.id = pr.people_id }; my @people_relations = $db->select_rows( sql => $people_relations_stmt, bind => [ $resource_id ], hashref => 1 );