diff --git a/ground/classes/Image.php b/ground/classes/Image.php new file mode 100644 index 0000000..f406d91 --- /dev/null +++ b/ground/classes/Image.php @@ -0,0 +1,107 @@ + 'root', 'dbname' => 'poi', ), - //'version' => trim(file_get_contents(dirname(__FILE__).'/version')), + 'images' => array( + // 'dirName' => array(maxX, maxY, quality), + 'small' => array(200, 150, 100), + 'middle' => array(555, 450, 90), + 'big' => array(1110, 900, 90), + ), + //'version' => trim(file_get_contents(dirname(__FILE__).'/version')), ); diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index bbfd03c..7f54da5 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -70,7 +70,29 @@ class JsonController extends Controller */ static function actionAddPoint() { - $errors = array(); + $photos = array(); + $temp = pathinfo($_SERVER['SCRIPT_FILENAME']); + $uploaddir = $temp['dirname'] . '/photos/'; +// print_r($_FILES); +// print_r($_REQUEST); +// die; + if (isset($_FILES) && !empty($_FILES)) + { + foreach ($_FILES['photos']['name'] as $key => $fileName) + { + $temp = pathinfo($_FILES['photos']['name'][$key]); + + $foto = strtolower('_' . substr(md5($fileName . time()), 0, 5) . '.' . $temp['extension']); + if (move_uploaded_file($_FILES['photos']['tmp_name'][$key], $uploaddir . $foto)) + { + $photos[] = $foto; + } + } + } + print_r($photos); + die; + + $errors = array(); if(!( isset($_POST['name']) && $_POST['name'] && strlen($_POST['name']) > 1 )) $errors[1]='Неверное название точки'; if(!( isset($_POST['img']) && $_POST['img'] && strlen($_POST['img']) > 13 )) $errors[2]='Плохая ссылка на изображение'; diff --git a/ground/views/modals/addPoint.php b/ground/views/modals/addPoint.php index c30efc8..450127f 100644 --- a/ground/views/modals/addPoint.php +++ b/ground/views/modals/addPoint.php @@ -6,29 +6,35 @@ + +
+ +
+ diff --git a/public/css/style.css b/public/css/style.css index 40b2ae8..5e86bd8 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -20,6 +20,11 @@ div.header a:hover {text-decoration: none;} div.header a:hover h1 {cursor: pointer;} div.add {cursor: pointer;} +#addPointModal .extraImage .button {cursor: pointer;} +#addPointModal .extraImage .remove:hover {background-color: #d44950; color: #fff;} +#addPointModal .extraImage .add:hover {background-color: #49d450; color: #fff;} +#addPointModal .extraImage .type.button:hover {background-color: #ddd;} + .form-group .error {display: none;} .form-group.has-error .error {display: inline-block;} diff --git a/public/photos/_84b8e.jpg b/public/photos/_84b8e.jpg new file mode 100644 index 0000000..681afde Binary files /dev/null and b/public/photos/_84b8e.jpg differ