month_full()->month_a() to unify month elements naming
authorshort <>
Thu, 16 Aug 2001 12:30:54 +0000 (12:30 +0000)
committershort <>
Thu, 16 Aug 2001 12:30:54 +0000 (12:30 +0000)
img_size($one_argument_file_name) autodetects its image size

common.php

index 3640ecf..ec896f4 100644 (file)
@@ -109,17 +109,26 @@ function db_item($query)
        return($row[0]);
 }
 
-function month_full($year,$month,$month_last=0)
+function month_a($year,$month,$month_last=0)
 {
        global $tb_obsah;
 
        if (!$month_last)
                $month_last=db_item("select month_last from $tb_obsah where year='$year' and month='$month'");
-       return(sprintf("%02d".($month==$month_last ? "" : "-%02d"),$month,$month_last));
+       $month_full=sprintf("%02d".($month==$month_last ? "" : "-%02d"),$month,$month_last);
+
+       $r=array("year"=>$year,"month"=>$month,"month_last"=>$month_last,"month_full"=>$month_full,
+                       "name"=>"$year/${month_full}",
+                       "img" =>"img/eap-$year-${month_full}.jpg",
+                       "icon"=>"img/eap-$year-${month_full}s.jpg",
+                       );
+       return($r);
 }
 
-function img_size($width,$height)
+function img_size($width,$height=0)
 {
+       if (!$height)
+               list($width,$height)=getimagesize($width);
        return("style=\"border:0;width:${width}px;height:${height}px\" width=\"$width\" height=\"$height\"");
 }