Esempio n. 1
0
                 $heights[$i] = $x[1];
                 $i++;
             }
         }
     } else {
         // error
         $result = 100;
         $message = "Missing parameters(dimension)";
     }
     if ($result == 0) {
         if ($type == 'posting') {
             $image_info = convert_posting($src, $dst, $widths, $heights);
             $message = $image_info[0] . 'x' . $image_info[1];
         } else {
             if ($type == 'theme') {
                 $image_info = convert_theme($src, $dst, $widths, $heights);
                 $message = $image_info[0] . 'x' . $image_info[1];
             } else {
                 if ($type == 'profile') {
                     $image_info = convert_profile($src, $dst, $widths, $heights);
                     $message = $image_info[0] . 'x' . $image_info[1];
                 } else {
                     $result = 303;
                     $message = "Invalid parameter. type=" . $type;
                 }
             }
         }
     }
 } else {
     $result = 400;
     $message = "File does not exist.";
Esempio n. 2
0
    } else {
        $i = 0;
        foreach ($arr as $sizes) {
            $x = explode('x', $sizes);
            if (count($x) != 2) {
                // error
                $message = "Invalid parameters format (dimension)";
                $result = -8;
                break;
            } else {
                $widths[$i] = $x[0];
                $heights[$i] = $x[1];
                $i++;
            }
        }
    }
    if ($result == 0) {
        if ($type == 'posting') {
            $result = convert_posting($src, $dst, $widths, $heights);
        } else {
            if ($type == 'theme') {
                $result = convert_theme($src, $dst, $widths, $heights);
            } else {
                if ($type == 'profile') {
                    $result = convert_profile($src, $dst, $widths, $heights);
                }
            }
        }
    }
    echo ${result} . ':' . ${message};
}