Jump to content

Page Image Manipulator | API for 1 & 2


horst

Recommended Posts

2 hours ago, Crowdland Technology said:

Tried to enable webp support and get this error:

Hi,
PIM doesn't have webP support. It was written years before webP support comes into core, and it needs to be completly rewritten. (I also have started 2-3 times, but far from finishing. No time for it ? )

You may use a (clumpsy) workaround. First create a watermark image with 100% quality an sharpening = none, and then finally pass it through the core width() or size() function. This way you can use what ever webp strategy you like as it is always delegated to the core image handling. Downside is one additional (intermediate) variation in the chain.

$options = ['sharpening'=>'none', 'quality'=>100];
$image_intermediate = $prop->images->eq(0)->pim2Load("wtm",true, $options)->height(480)->watermarkLogo($watermark, $position='center', $padding=2)->pimSave();

$image_url = $image_intermediate->height($image_intermediate->height)->url;  // saves the image with 480px height, but with all default settings for quality, sharpening, webP, etc.

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi @horst - my first time using this, so sorry if this is a dumb question, but why is the text outlined rather than solid? I don't understand how to get it more legible. Is it also possible to specify the font color and perhaps also the font itself (also this is less important).

Also, the "true" after the prefix doesn't seem to work - I need to keep changing the name "watermark" to something else to get it to update the image with my new settings. Am I doing that correctly?

Thanks.

image.thumb.png.01a90764294f5ae99e4c31ff782ea98d.png

Link to comment
Share on other sites

12 hours ago, adrian said:

but why is the text outlined rather than solid? I don't understand how to get it more legible. Is it also possible to specify the font color and perhaps also the font itself (also this is less important).

This was a try to automatically detect the colors and hue and create a grayscale watermark text. A full file path to a TTF-fontfile can be passed as param to the function.

Here you can read about the function in general:

 

Link to comment
Share on other sites

2 hours ago, horst said:

This was a try to automatically detect the colors and hue and create a grayscale watermark text

Would you be ok with accepting a PR that allows an option to simply provide a solid font color?

Also still curious about the $forceRecreation boolean not working - am I doing that wrong?

Thanks.

Link to comment
Share on other sites

3 hours ago, adrian said:

Would you be ok with accepting a PR that allows an option to simply provide a solid font color?

Yep!!! ?

3 hours ago, adrian said:

Also still curious about the $forceRecreation boolean not working - am I doing that wrong?

I'm not sure. Maybe I haven't use this function in the last 5 years. I will try to look at it in the next days.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 1 month later...
On 4/13/2021 at 2:51 PM, MSP01 said:

It's a little thing, but would it be possible to create images without the .-pim2- part?

Currently:
original.jpg
becomes:
original.-pim2-prefix.jpg

I'd prefer if it became:
originalprefix.jpg

I would like to have that feature too!

Link to comment
Share on other sites

  • 8 months later...

Hi! This is a really useful module. I use it to combine some graphics with the watermark option. However today a host of my client updated to PHP 8 und I got a 
fatal error: Exception: Cannot load the MemoryImage!

After donwgrading to PHP 7.4. everything worked again. The host told the client they will switch to PHP 8 next year and only offer paid support for older versions, so it would be nice if I can continue to use this module. Are there any plans to support PHP 8 in the future? 

  • Like 1
Link to comment
Share on other sites

1 hour ago, jploch said:

Are there any plans to support PHP 8 in the future?

I will check and update it when I have installed a local php 8 environment. So do not expect it in the next weeks. But definetly get updated to php 8.

  • Like 1
Link to comment
Share on other sites

@jploch Ok, seems to be fixed. I haven't bumped the modules version number in PWs modules system now.

Please manually (FTP) update these two files:
https://github.com/horst-n/PageImageManipulator/blob/master/PageImageManipulator02.module
https://github.com/horst-n/PageImageManipulator/blob/master/ImageManipulator02.class.php

If you can try it out and report back, this would be fine. Also on github was a issue report from @Craig with a fix! (Thanks ? ) Haven't seen this, as I train to use git from the command line for the last month. ?

  • Like 1
Link to comment
Share on other sites

  • 3 months later...
  • 5 months later...
  • 3 months later...

@horst after a PHP upgrade to 8.2 we get these deprecation warnings:

PHP Deprecated: Creation of dynamic property ImageManipulator02::$originalImage is deprecated in ImageManipulator02.class.php:215

PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions1 is deprecated in ImageManipulator02.class.php:265

PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions2 is deprecated in ImageManipulator02.class.php:267

PHP Deprecated: Creation of dynamic property ImageManipulator02::$dibIsLoaded is deprecated in ImageManipulator02.class.php:839

PHP Deprecated: Creation of dynamic property ImageManipulator02::$iptcRaw is deprecated in ImageManipulator02.class.php:362

 

  • Thanks 1
Link to comment
Share on other sites

  • 7 months later...

Has this been deprecated? Just tried this module on a site, trying to get watermarks on its opengraph images, and I'm getting this error:

Compile Error: Array and string offset access syntax with curly braces is no longer supported (line 2385 of site/modules/PageImageManipulator/ImageManipulator.class.php)

(My server is running PHP 8.0)

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
On 10/30/2023 at 12:29 PM, heldercervantes said:

Has this been deprecated? Just tried this module on a site, trying to get watermarks on its opengraph images, and I'm getting this error:

Compile Error: Array and string offset access syntax with curly braces is no longer supported (line 2385 of site/modules/PageImageManipulator/ImageManipulator.class.php)

(My server is running PHP 8.0)

I've just had the same error and realised that if you just simply download the module and install it, it installs v1. So you have to go to Modules > New, uninstall v1 and install v2 as both versions are included in the module folder. Of course the new version only works with the pim2Load() method so you have to change that too.

 

Screenshot 2024-03-05 at 09.56.11.png

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...