<?php if (!empty($sliders)) { ?> <div class="mainSliderWrap"> <div class="mainSlider"> <?php foreach ($sliders as $slider) { ?> <?php $imageUrl = MSFiles::getImageUrl($slider['image'], 'min'); if (empty($imageUrl)) { continue; } ?> <div style="background-image: url('<?php echo $imageUrl; ?> ');"> <div class="slideText"> <div> <?php if (!empty($slider['title'])) { ?> <div class="slideTextTitle"><?php echo $slider['title']; ?> </div> <?php }
// $items[$key]['image_out'] = $r; // } //} // //foreach ($items as $key => $item) { // $sql = 'UPDATE ' . PRFX . "catalog_items SET `image_out`='" . $item['image_out'] . "' WHERE `id`=" . $item['id']; // MSCore::db()->execute($sql); //} $conf = array(80, 80, true, 'watermark' => array('src' => DOC_ROOT . '/DESIGN/SITE/images/watermark50x50.png', 'offset_x' => 15, 'offset_y' => 10)); $conf2 = array(300, 200, true, 'watermark' => array('src' => DOC_ROOT . '/DESIGN/SITE/images/watermark200x200.png', 'offset_x' => 50, 'offset_y' => 0)); $conf3 = array(720, 480, true, 'watermark' => array('src' => DOC_ROOT . '/DESIGN/SITE/images/watermark400x400.png', 'offset_x' => 150, 'offset_y' => 0)); foreach ($items as $key => $item) { if (isset($galleries[$key])) { $result = MSFiles::makeImageThumb(DOC_ROOT . $galleries[$key], $conf); $result2 = MSFiles::makeImageThumb(DOC_ROOT . $galleries[$key], $conf2); $result3 = MSFiles::makeImageThumb(DOC_ROOT . $galleries[$key], $conf3); $r = unserialize($item['gallery']); $r[0]['path']['min'] = $result; $r[0]['path']['first'] = $result2; $r[0]['path']['win'] = $result3; $r = serialize($r); $items[$key]['gallery'] = $r; } } foreach ($items as $key => $item) { $sql = 'UPDATE ' . PRFX . "catalog_items SET `gallery`='" . $item['gallery'] . "' WHERE `id`=" . $item['id']; MSCore::db()->execute($sql); } //$count = 0; // //foreach ($items as $key =>$item) {
/** * Для приема файла из формы */ public function fileAction() { if (isset($_FILES['file']['tmp_name']) && isset($_FILES['file']['name'])) { $MSFiles = new MSFiles(); $tempFileDir = FILES_DIR . DS . 'tmp_files' . DS; if (!file_exists($tempFileDir)) { mkdir($tempFileDir); } if (!empty($_POST['id'])) { $type = $_POST['id']; } else { $this->errorAction(1001, 'Custom system error', ['error' => 'noType']); } $result = $MSFiles->uploadFile($tempFileDir, ['allowedExtensions' => ['jpg', 'gif', 'png', 'jpeg', 'doc', 'docx', 'xls', 'xlsx'], 'sizeLimit' => 5 * 1024 * 1024, 'inputName' => 'file', 'limit' => 1]); if ($result['success']) { $_SESSION['uploaded'][$type] = ['name' => $result['uploadName'], 'directory' => $tempFileDir . $result['uploadName']]; } else { $this->errorAction(1001, 'Custom system error', ['error' => 'noCopy']); } $this->addData(['succes' => 'Ok']); $this->successAction(); } else { $this->errorAction(1001, 'Custom system error', ['error' => 'noFile']); } }