aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Model/PhotoSet.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Model/PhotoSet.pm')
-rw-r--r--perllib/FixMyStreet/App/Model/PhotoSet.pm29
1 files changed, 22 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Model/PhotoSet.pm b/perllib/FixMyStreet/App/Model/PhotoSet.pm
index e8396b5aa..35a7e8a53 100644
--- a/perllib/FixMyStreet/App/Model/PhotoSet.pm
+++ b/perllib/FixMyStreet/App/Model/PhotoSet.pm
@@ -222,7 +222,7 @@ sub get_image_data {
} elsif ( $size eq 'full' ) {
# do nothing
} else {
- $photo = _shrink( $photo, $self->c->cobrand->default_photo_resize || '250x250' );
+ $photo = _shrink( $photo, $args{default} || '250x250' );
}
return $photo;
@@ -239,6 +239,27 @@ sub delete_cached {
);
}
+sub remove_images {
+ my ($self, $ids) = @_;
+
+ my @images = $self->all_images;
+ my $dec = 0;
+ for (sort { $a <=> $b } @$ids) {
+ splice(@images, $_ + $dec, 1);
+ --$dec;
+ }
+ my @items = map $_->[0], @images;
+
+ my $new_set = (ref $self)->new({
+ data_items => \@items,
+ object => $self->object,
+ });
+
+ $self->delete_cached();
+
+ return $new_set->data; # e.g. new comma-separated fileid
+}
+
sub rotate_image {
my ($self, $index, $direction) = @_;
@@ -250,7 +271,6 @@ sub rotate_image {
my $new_set = (ref $self)->new({
data_items => \@items,
- c => $self->c,
object => $self->object,
});
@@ -272,11 +292,6 @@ sub _rotate_image {
}
-
-
-
-# NB: These 2 subs stolen from A::C::Photo, should be purged from there!
-#
# Shrinks a picture to the specified size, but keeping in proportion.
sub _shrink {
my ($photo, $size) = @_;