Fixed .jpeg files image size.
[MyWeb.git] / Web.pm
diff --git a/Web.pm b/Web.pm
index d99e54f..a6be6aa 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -413,6 +413,13 @@ my($url,$contents,%args)=@_;
        return $contents;
 }
 
+sub make ($)
+{
+my($cmd)=@_;
+
+       system {'flock'} 'flock','-x',top_dir_disk(),$cmd.' >&2';
+}
+
 sub img_size ($$)
 {
 my($width,$height)=@_;
@@ -439,12 +446,15 @@ sub img_src ($)
 {
 my($file_base)=@_;
 
-       if (!url_is_local($file_base)
-                       # Known image extension?
-                       || $file_base=~m#$img_variants_re#o) {
+       if (!url_is_local($file_base)) {
                return $file_base if !wantarray();
                return ($file_base,$file_base);
                }
+       # Known image extension?
+       if ($file_base=~m#$img_variants_re#o) {
+               return $file_base if !wantarray();
+               return (top_dir($file_base),top_dir_disk().$file_base);
+               }
 
        my $file_base_disk;
        my $file_base_uri;
@@ -460,8 +470,8 @@ my($file_base)=@_;
        for my $var (@img_variants) {
                my $file=$file_base_disk.".".$var->{"id"};
                # TODO: Somehow quickly check dependencies?
-               system 'make >&2 -s --no-print-directory'
-                                               .' -C '."'".File::Basename::dirname($file)."' '".File::Basename::basename($file)."'"
+               make('make -s --no-print-directory'
+                                               .' -C '."'".File::Basename::dirname($file)."' '".File::Basename::basename($file)."'")
                                if !-f $file;
                push @nego_variants,negotiate_variant(
                                %$var,