Jump to content

Hardoman

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

2 Neutral

About Hardoman

  • Rank
    Newbie
  • Birthday May 7

Profile Information

  • Gender
    Male
  • Location
    Bremen, Germany
  1. @horst Little update, this might be helpful for explanation: we quickly tested editing the PIM02.module file (around line 122) and that seems to work for our demand: $suffix = str_replace('-', '', $prefix); $suffix = "{$suffix}"; // $suffix = "pim2-{$suffix}"; if (false === strpos($p['filename'], '.')) $suffix = '.' . $suffix; After this modification the watermark image is still there and it would work, unless somebody would like to delete all the variations the common way. 🤔
  2. @horst Thanks for your quick reply! 🙂 We would like to offer both types original and watermarked image. So that the user would be able to choose between them and post them in the editor. This already works now but not after somebody deletes the original image from the array. We already tried to clone the object but there still is some link the the variations and also in the cloned object, the variations disappear. Probably in this case its not good to put the hook into the ready.php file.
  3. Unfortunately, I have to re-open this topic once more. When we implement the function above, the pim-created image is saved as a variation along with the original image. If you now embed the watermark image and somebody removes the original image, all the variations are gone, so the pim-image will vanish as well and furthermore the user will get a warning. I did not find out yet, where I can avoid the new image to be deleted when the original one is being deleted. So would there be a way to duplicate the watermark image that it would be treated like a separate orignal one? Probably by cloning the pagefile object or something like this? Any help would be highly appreciated. Thank you.
  4. Hello Horst, thanks again for your hints, the following solution works for me, replaces the original image and the merged image is usable in the editor afterwards: (Code is embedded in ready.php) $this->addHookBefore("InputfieldImage::fileAdded", function ($event) { // Get the image $image = $event->argumentsByName('pagefile'); // Location of watermark image $pngAlphaImage = $config->paths->templates . 'watermark.png'; //Save image with watermark $master = $image->pim2Load('full', false)->watermarkLogo($pngAlphaImage,'SE', 0)->pimSave(); //Setting some variations $sizeArray = array(array(448, 336), array(678, 506), array(908, 676)); foreach($sizeArray as $sizes) { $master->size($sizes[0], $sizes[1], array('upscaling'=>false, 'cropping'=>false, 'quality'=>90, 'sharpening'=>'soft')); } $image->setFilename($master); //Set generated image as main image $image->setOriginal($master); });
  5. Hello Bernhard, hello Horst, many thanks for your hints and the big code chunk sent by Horst. I'm still testing and will update this comment, when I am done or if there are more questions. Thank you very much. 🙂
  6. Hello community, we have a website running version 3.0.118. The owner would like to have a watermark merged to the images, that are being uploaded in the CKEditor as a requirement. Image upload besides the CKEditor within galleries and single images works as a charm already. We also use croppable image 3 there. (PIM2) To realize this requirement, I thought of using a hook in the admin area. So, I read a lot in our forums and tested this by adding a hook into the ready.php file. $this->addHookAfter('InputfieldFile::fileAdded',function(HookEvent$event){ wire('log')->save('test','Image upload works'); ... The log entry is being created correctly. But when I try to use the pim/watermark-function like in a template, he cannot find the watermark-image anymore. Furthermore, when I try to get the page-id, it does not seem to be accessible, because the application does not seem to know how to reference it, or I dont know the right way to do so… So my questions are: Is this the right attempt at all or will there be another, better workaround? It seems, I cannot access the page object (of the content page) within this scope or file but I would need it to save the processed image inside the right files/id folder Would it be better to place the hook into the admin-template? (or admin.php) Thanks for any hints in advance. 🙂
  7. @Robin, many thanks for your hints! I also discovered the hook to add custom classes which I added to the secondary menu. That way, I'm able to make it nicely responsive. Have a nice evening.
  8. Hello Robin, thanks for welcoming me and for the solution provided. Sorry for my late reply, I just tried it using the 'xtemplates' option and it worked like a charm! Well, actually, I have another question: Is there a way to provide a 2nd menu using these options which would also collapse with the 'main-menu' into the mobile menu when the page is being resized? But I will try to read all the post in this forum at first.. Thanks once more.
  9. Hello there, I would like to place a weblink into the MarkupSimpleNavigation, that would open this link in a new tab (target="_blank"). Unfortunately, I did not find any solution yet. Thanks in advance for your hints. Best regards
×
×
  • Create New...