示例#1
0
 function addAllImages()
 {
     if (!empty($this->mainImage)) {
         $mImage = str_replace('//', '/', $this->path . 'main_' . Generator::strToLat($this->mainImage));
         $this->addImage($mImage, TRUE);
         Helper::moveFile('mainimage', TRUE, $this->productId);
     }
     if (!empty($this->images[0]) && is_array($this->images)) {
         foreach ($this->images as $img) {
             $image = str_replace('//', '/', $this->path . Generator::strToLat($img));
             $this->addImage($image, FALSE);
         }
         Helper::moveFile('images', FALSE, $this->productId);
     }
 }
示例#2
0
 public function updatePhoto()
 {
     if (empty($this->id)) {
         $this->id = $this->user['id'];
     }
     $this->path = $this->path . $this->id;
     try {
         if ($this->photo) {
             $st = $this->db->prepare("UPDATE {$this->table} SET `photo` = :photo WHERE `id` = :id");
             $st->execute([':photo' => $this->path . '/main_' . Generator::strToLat($this->photo), ':id' => $this->id]);
             Helper::moveFile('photo', TRUE, $this->id, 'userimg');
         }
     } catch (Exception $ex) {
         $ex->getMessage();
     }
 }