function sf_image_path($filename, $options = array(), $absolute = false) { if (isset($options['f'])) { $f = $options['f']; } elseif (isset($options['format'])) { $f = $options['format']; } elseif (is_callable(array($filename, 'getType'))) { $f = str_replace('image/', '', $filename->getType()); } else { $parts = explode('_', $filename); $f = array_pop($parts); } if ($f !== 'jpg' && $f !== 'png' && $f !== 'gif') { $f = 'jpg'; } $size = null; if (isset($options['size'])) { $size = $options['size']; } if (!isset($options['square']) && (0 === strpos($filename, 'm_') || 0 === strpos($filename, 'c_'))) { // member image / community image $options['square'] = true; } $square = isset($options['square']) ? (bool) $options['square'] : false; $class = sfImageHandler::getStorageClassName(); return call_user_func(array($class, 'getUrlToImage'), $filename, $size, $f, $absolute, $square); }
public function delete(Doctrine_Connection $conn = null) { if ($this->isImage()) { $class = sfImageHandler::getStorageClassName(); $storage = call_user_func(array($class, 'create'), $this, $class); $storage->deleteBinary(); } return parent::delete($conn); }
public function delete(Doctrine_Connection $conn = null) { if (!$this->getFile()->isImage() || $this->getBin()) { return parent::delete($conn); } if (!$this->isFirstDelete) { $this->isFirstDelete = true; return parent::delete($conn); } $this->isFirstDelete = false; $class = sfImageHandler::getStorageClassName(); $storage = call_user_func(array($class, 'create'), $this->getFile(), $class); return $storage->deleteBinary(); }
function sf_image_path($filename, $options = array(), $absolute = false) { if (isset($options['f'])) { $f = $options['f']; } elseif (isset($options['format'])) { $f = $options['format']; } elseif (is_callable(array($filename, 'getType'))) { $f = str_replace('image/', '', $filename->getType()); } else { $parts = explode('_', $filename); $f = array_pop($parts); } if ($f !== 'jpg' && $f !== 'png' && $f !== 'gif') { $f = 'jpg'; } $size = null; if (isset($options['size'])) { $size = $options['size']; } $class = sfImageHandler::getStorageClassName(); return call_user_func(array($class, 'getUrlToImage'), $filename, $size, $f, $absolute); }