Jump to content
horst

Page Image Manipulator 1

Recommended Posts

Hi Horst,

pim2 v0.2.9 running on PW 2.8.62 overwrites the original image instead of making a variation.

I'm using the canvas method

<img src="<? echo $image->pim2Load('pim')->setQuality(90)->setOutputFormat('png')->canvas(240,160)->pimSave()->httpUrl; ?>">

chears,
JFN.

 

Is this thread abandoned??

Edited by JFn
no reaction

Share this post


Link to post
Share on other sites

Good day, @horst!

Was messing with an old site of mine. I did not even remember I used pim2 on this one. And getting to use this powerful tool once again was a pleasure. Thank you for your work!

I had to make a overblurred version of an image for a background. So I used smooth(255) about a 10 times in a row. That did the trick, but the code looks kind of ugly. Am I missing some shortcut way to do it in a more beautiful manner?

Share this post


Link to post
Share on other sites

Hi @Ivan Gretsky, thanks for the nice words.

To make an image overblurred, there is only the "blur" and the "smooth" functions. But maybe you can experiment with using "pixelate" before "smooth"?

pixelate(2) or pixelate(3) and then smooth(255), (regarding your desription, maybe 2-3 times smooth(255))

Or isn't that what you are asking for?

  • Like 1

Share this post


Link to post
Share on other sites

@Ivan Gretsky, if you have Imagick installed you could use this function I wrote a while back for easy ImageMagick effects:

It does quite a nice blur. But now that supporting IE is less of an issue you could also try a CSS filter.

  • Like 2

Share this post


Link to post
Share on other sites

Hi Jonathan, sorry, I completly missed that one. 😳

Will looking into it next week. 🤞

And thanks for showing the issue by video, what makes it very clear to follow!

Share this post


Link to post
Share on other sites

@Jonathan Lahijani Hmm, there is no fast fix possible ATM. BUT you may use this code, passing the options array as second param to pim2Load, what works as expected:

$image1->pim2Load('i1')->setOptions(['outputFormat'=>'jpg'])->pimSave(); // FAILES (with outputFormat, all other settings work as expected)
$image2->pim2Load('i2', ['outputFormat'=>'jpg'])->pimSave();  // works!!

Summary: all option settings work in both ways, BUT changing the outputFormat only works correctly when passed as options argument into pim2Load().

(I think it needs a massive rewrite to fix that properly, for that I have no time atm 😞)

Share this post


Link to post
Share on other sites

There are serious issues with this module running PW 3.0.123+. Didn't have time to debug properly, but on different sites the pim2load didn't work anymore.

Two different examples that didn't work anymore:
$img->pim2Load('img_name')->width(640)->grayscale()->setQuality(80)->pimSave()->url;
$img->pim2Load('img_name')->setQuality(90)->setOutputFormat('png')->canvas(240,160)->pimSave()->httpUrl;

I ended up disabling the module and using core image manipulations (except for the grayscale... it looks much better in color anyway 😎)

Share this post


Link to post
Share on other sites

@JFn I cannot confirm this. I tested with different newer PW versions up to 3.0.131. Everything is working as expected and like with older PW versions.

Only thing from your examples that did not work, is to use the ->setOutputFormat(). How to handle this, please read my post directly above yours.

 

Share this post


Link to post
Share on other sites

Just a heads up, I'm getting this warning on PHP 7.3.6 :

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/zzzzzz/dev/site/assets/cache/FileCompiler/site/modules/PageImageManipulator/ImageManipulator02.class.php on line 525 

 

Share this post


Link to post
Share on other sites

@Macrura thanks for the hint.

Have you tried to change that continue into break at line 525? Does it solve the Warning?

Share this post


Link to post
Share on other sites

yes, it solves the warning for sure.

On a separate topic – is there anyway to set the color of watermark text?

Share this post


Link to post
Share on other sites
10 hours ago, Macrura said:

On a separate topic – is there anyway to set the color of watermark text?

Sorry, no. The current text watermark method analyzes the images and decides between white, gray and black in a automated way. The reason behind that is, you can apply text to any images without knowing which colors it includes.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By eelkenet
      Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. 
      EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/
       
      What is it?
      The missing range slider Inputfield for Processwire. 
      What does it do?
      This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
      It includes a visible and editable value field, to override/tweak the value if required.  
      Features
      Min/max values Precision (number of decimals) Optional step value (Read more) Optional manual override of the selected value (will still adhere to the rules above) Configurable rounding of manually entered values (floor, round, ceil, disable) Usage
      Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo
      A field with Min=0, Max=1, Step=0.2, Precision=2

      Field with settings Min=0, Max=200, Step=0.25, Precision=2

       
      Todo
      Make the display-field's size configurable (will use the Input Size field setting)  Hopefully become redundant  
      Changelog
      004 (current version)
      - Make rounding of manually entered values configurable (floor, round, ceil or disable)
      - Fix small JS bug when the value-display field was not displayed
      - Update README
      003
      - Code cleanup, add some ModuleInfo data & LICENSE
      - Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/)
      002
      - Fix issue where setting the step value to an empty value created problem with validation
      - Make the display-field optional
      001
      - Initial release
       
      Thanks!
       
       
    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-10-18
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By NehaPillai
      Hello Everyone, I was trying to update SEO meta title, description and meta keywords for my website in Process Wire CMS but it saving in the backend but it is not reflecting on my website, Please help me regarding this error. Please find below attached screen shot for your ref. TIA.


    • By adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
×
×
  • Create New...