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

@horst THX for the quick fix! Unfortunately my client already made the change to PHP 7.4. and I do not have a php 8 environment to test this at the moment. I will report back once I setup a local test environment.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hello, I'm trying to put a watermark text on top of my image but I got strange result as you can see...any idea why the font is rendered like that? I'm using a simple Roboto font.
Thanks

Annotazione 2022-06-08 132034.jpg

Link to comment
Share on other sites

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...