function smarty_function_imagefilename($params, $smarty) { if (!isset($params['id'])) { $params['id'] = 0; } if (!isset($params['w'])) { $params['w'] = 0; } if (!isset($params['h'])) { $params['h'] = 0; } require_once $smarty->_get_plugin_filepath('function', 'geturl'); $hash = DatabaseObject_Image::GetImageHash($params['id'], $params['w'], $params['h']); $options = array('controller' => 'utility', 'action' => 'image'); $username = $params['username']; return sprintf('%s?id=%d&w=%d&h=%d&hash=%s&username=%s', smarty_function_geturl($options, $smarty), $params['id'], $params['w'], $params['h'], $hash, $username); }
public function getImages() { $options = array('event_id' => $this->getId()); //loading images $this->images = DatabaseObject_Image::GetImages($this->getDb(), $options, 'event_id', 'events_images'); }
public function setUsername($username) { self::$username = $username; }
public function getImages() { $options = array('Product_id' => $this->getId()); //loading images $this->images = DatabaseObject_Image::GetImages($this->getDb(), $options, 'Product_id', 'product_inventory_images', 'inventory'); }
public static function removeProductAndInventoryImage($db, $fatherTable, $imagetable, $product_tag, $imageID, $postID, $userID) { if ($product_tag == 'inventory') { $okayBool = DatabaseObject_Helper_InventoryManager::verifyInventoryItemForUser($db, $postID, $userID); } else { $okayBool = DatabaseObject_Helper_ProductListing::confirmproductforuploader($db, $fatherTable, $userID, $postID); } if ($okayBool) { $image = new DatabaseObject_Image($db, $imagetable, $product_tag); if ($image->loadForPost($postID, $imageID)) { echo 'here at load image'; if ($image->delete()) { echo 'here at delete image'; return true; } else { return false; } } else { echo 'image not loaded'; } } else { echo 'You have no permission to perform this action'; return false; } }
public function imagesAction() { $request = $this->getRequest(); $json = array(); $user_id = (int) $request->getPost('id'); $user = new DatabaseObject_User($this->db); if (!$user->load(Zend_Auth::getInstance()->getIdentity()->userID)) { $this->_redirect($this->getUrl()); } if ($request->getPost('upload')) { $fp = new FormProcessor_Image($user); if ($fp->process($request)) { $this->messenger->addMessage('Image uploaded'); } else { foreach ($fp->getErrors() as $error) { $this->messenger->addMessage($error); } } } elseif ($request->getPost('reorder')) { $order = $request->getPost('post_images'); $options = array('user_id' => Zend_Auth::getInstance()->getIdentity()->userID); //loading images $images = DatabaseObject_Image::GetImages($this->db, $options, 'user_id', 'users_profiles_images'); $user->images = $images; $user->setImageOrder($order); } elseif ($request->getPost('delete')) { $image_id = (int) $request->getPost('image'); $image = new DatabaseObject_Image($this->db); if ($image->loadForPost($user->getId(), $image_id)) { $image->delete(); //the files are unlinked/deleted at preDelete. //echo "image at delete"; if ($request->isXmlHttpRequest()) { $json = array('deleted' => true, 'image_id' => $image_id); } else { $this->messenger->addMessage('Image deleted'); } } } if ($request->isXmlHttpRequest()) { $this->sendJson($json); } else { $url = $this->getUrl('details'); $this->_redirect($url); } }