public function __toString() { $imageFile = $this->_getRequestedImageFile(); if ($this->_imageShouldComeFromCloudinary($imageFile)) { $image = Image::fromPath($imageFile); $transformation = $this->_configuration->getDefaultTransformation()->withDimensions($this->_dimensions); return (string) $this->_imageProvider->transformImage($image, $transformation); } return parent::__toString(); }
/** * @return string */ public function __toString() { $originalUrl = parent::__toString(); $product = $this->getProduct(); $documentId = Mage::helper('web2print')->getItemId($product->getWeb2printDocumentId()); // is it a chili document and is the preview allowed? if (!($this->chiliPreviewAllowed() && $documentId)) { return $originalUrl; } // if product image is uploaded in backend, show original image if ($product->getData($this->_getModel()->getDestinationSubdir()) != "no_selection" && $documentId) { return $originalUrl; } // is the image cached? if ($this->getCacheImage($documentId)) { return $this->getCacheImage($documentId); } // redirect to the chili-generated image: $url = $this->_getChiliImageUrl($documentId); return $url; }
/** * Return Image URL * * @return string */ public function __toString() { $url = parent::__toString(); $imagePath = $url; $baseUrl = Mage::getStoreConfig('web/unsecure/base_url'); $imagePath = str_replace($baseUrl, '/', $imagePath); $imagePath = str_replace('/', DS, $imagePath); // decrypt image path $imagePath = Mage::helper('core')->encrypt(base64_encode($imagePath)); $imagePath = str_replace('+', 'plus', $imagePath); $imagePath = urlencode($imagePath); $imageUrl = $baseUrl . 'totowatermarkplus/index/index?image=' . $imagePath; return $imageUrl; }
/** * In older versions of Magento (<1.1.3) this method was used to get an image URL. * However, 1.1.3 now uses the getUrl() method in the product > image model. This code * was added for backwards compatibility. * * @return string */ public function __toString() { parent::__toString(); return $this->_getModel()->getUrl(); }
/** * Return a URL that will trigger a lazy image creation on request * * NOTE: This URL is meant to be fronted by a caching proxy or CDN * * @return string */ public function __toString() { if (!Mage::getStoreConfigFlag('catalog/product_image/lci_active')) { return parent::__toString(); } Varien_Profiler::start('LCI: Aoe_LazyCatalogImages_Helper_Catalog_Image->__toString'); try { $params = array(); $params['ds'] = $this->_getModel()->getDestinationSubdir(); if ($this->getImageFile()) { $params['f'] = $this->getImageFile(); } elseif ($this->getProduct()) { $params['f'] = $this->getProduct()->getData($this->_getModel()->getDestinationSubdir()); } $params['fr'] = $this->getAngle(); $params['fw'] = $this->_getModel()->getWidth(); $params['fh'] = $this->_getModel()->getHeight(); $params['fq'] = $this->_getModel()->getQuality(); // use 1 and 0 instead of true and false to lower the filename length $params['fa'] = $this->_keepAspectRatio ? 1 : 0; $params['ft'] = $this->_keepTransparency ? 1 : 0; $params['ff'] = $this->_keepFrame ? 1 : 0; if ($this->getWatermark()) { $params['wf'] = $this->getWatermark(); $params['wo'] = $this->getWatermarkImageOpacity(); $params['wp'] = $this->getWatermarkPosition(); $params['ws'] = $this->getWatermarkSize(); } // Encode the parameters into a tamper-proof, URL-safe token $token = $this->generateToken($params); // Set a default file extension for caching reasons $extension = self::DEFAULT_EXTENSION; // Extract a file extension if possible if (isset($params['f']) && $params['f'] !== 'no_selection') { $extension = strtolower(pathinfo($params['f'], PATHINFO_EXTENSION)); } // Generate image URL $url = $this->getUrlFromToken($token, $extension); } catch (Exception $e) { // Log the exception so we can debug the problem later Mage::logException($e); // Generate placeholder image URL $url = Mage::getDesign()->getSkinUrl($this->getPlaceholder()); } Varien_Profiler::stop('LCI: Aoe_LazyCatalogImages_Helper_Catalog_Image->__toString'); return $url; }