Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

[+] MO : Watermark : Show nonwatermarked image for logged in customers #2

Merged
merged 1 commit into from
Nov 19, 2014

Conversation

PhpMadman
Copy link
Contributor

Part 1
This allows customer that are logged to see the images without watermark.
To prevent users to just add something like -nonwatermark to the path. I added a hash at install and at hook execution if no hash exist.
The hash is permenent and not deleted at uninstall, allowing owners to re-install the module, and don't need to generate images again.

Part 2 - PrestaShop/PrestaShop#2063

//go through file formats defined for watermark and resize them
foreach ($this->imageTypes as $imageType)
{
$newFile = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg';
if (!ImageManager::resize($file, $newFile, (int)$imageType['width'], (int)$imageType['height']))
$return = false;

$newFileOrg = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-'.stripslashes($imageType['name']).'-'.Configuration::get('WATERMARK_HASH').'.jpg';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI,

Can you please use snake case for variables and not camel case ?

Thank you.

Regards

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.

It's done.

gRoussac added a commit that referenced this pull request Nov 19, 2014
[+] MO : Watermark : Show nonwatermarked image for logged in customers
@gRoussac gRoussac merged commit 94d8c78 into PrestaShop:dev Nov 19, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants