Jump to content

pmichaelis

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by pmichaelis

  1. Hi everyone, I encountered the same issues with the ImageSizerEngineAnimatedGif and PHP 8 compatibility. The issues that prevented animated GIFs from being processed correctly. The module works fine under PHP 7 but fails under PHP 8 due to changes in how GD handles image resources. Issues Encountered GD Resource vs GdImage Object: PHP 8 changed GD image handling from resources to GdImage objects Array access on null values: Stricter type checking in PHP 8 caused "trying to access array offset on null" warnings File handling: Issues with fopen/fwrite combinations Complete Fix Applied Here are the changes to make the module PHP 8 compatible Add new helper method (after line 42) <?php /** * Helper method to check if a variable is a valid GD image resource/object * Compatible with both PHP 7 (resource) and PHP 8 (GdImage object) * * @param mixed $image * @return bool */ protected function isGdImage($image) { // PHP 8.0+ uses GdImage objects instead of resources if (class_exists('GdImage') && $image instanceof \GdImage) { return true; } // PHP 7.x uses resources return is_resource($image) && get_resource_type($image) === 'gd'; } Update module version (line 26) <?php 'version' => 2, // Increased for PHP 8 compatibility Replace all GD resource checks Line 176: if(!is_resource($frame)) → if(!$this->isGdImage($frame)) Line 178: if(!is_resource($bg)) → if(!$this->isGdImage($bg)) Line 205: if(!is_resource($nf)) → if(!$this->isGdImage($nf)) Line 234: if(isset($bg) && is_resource($bg)) → if(isset($bg) && $this->isGdImage($bg)) Line 235: if(isset($frame) && is_resource($frame)) → if(isset($frame) && $this->isGdImage($frame)) Line 236: if(isset($newimg) && is_resource($newimg)) → if(isset($newimg) && $this->isGdImage($newimg)) Line 271: if(!is_resource($frame)) → if(!$this->isGdImage($frame)) Line 275: if(is_resource($bg)) → if($this->isGdImage($bg)) Line 287: if(!is_resource($bg)) → if(!$this->isGdImage($bg)) Line 302: if(!is_resource($frame)) → if(!$this->isGdImage($frame)) Line 306: if(is_resource($bg)) → if($this->isGdImage($bg)) Line 318: if(!is_resource($bg)) → if(!$this->isGdImage($bg)) Line 335: if(!is_resource($nf)) → if(!$this->isGdImage($nf)) (This was the critical fix!) Line 361: if(isset($bg) && is_resource($bg)) → if(isset($bg) && $this->isGdImage($bg)) Line 362: if(isset($frame) && is_resource($frame)) → if(isset($frame) && $this->isGdImage($frame)) Line 363: if(isset($newimg) && is_resource($newimg)) → if(isset($newimg) && $this->isGdImage($newimg)) Improve file handling (lines 223-225 and 348-350) Replace: <?php $result = false === fwrite(fopen($srcFilename, 'wb'), $gifmerge->GetAnimation()) ? false : true; width: <?php $handle = fopen($srcFilename, 'wb'); $result = $handle && fwrite($handle, $gifmerge->GetAnimation()) !== false; if($handle) fclose($handle); frame validation (around line 340): <?php if(count($frames) > 0) { $gifmerge = new ISEAG_GIFEncoder( // ... existing code ); // ... file writing code } else { $result = false; } The main issue was on line 335 where if(!is_resource($nf)) prevented PHP 8's GdImage objects from being recognized as valid frames. An empty frame arrays was passed to the GIF encoder, causing the errors in gif_encoder.php. Hope this helps others who might encounter the same issues!
  2. Hey, there is a deprecation notice when running php 8.3 🥸 Deprecated: Calling get_class() without arguments is deprecated in .../cache/FileCompiler/site/modules/InputfieldAceExtended/InputfieldAceExtended.module on line 499 The error "Deprecated: Calling get_class() without arguments is deprecated" occurs when using PHP 8.3 or later to call the get_class() function without providing an argument. This is because the function's arguments are now required. Call get_called_class(), which works similarly to get_class() but doesn't require arguments. public static function getStatic($name) { $class = get_called_class(); return isset($class::$$name) ? $class::$$name : array(); }
  3. Hey, I have made an adjustment to the output of the hreflang tags in getCommonMetatags() On news pages with pagination, only the url of the page is currently output as hreflang. As I understand it, the url segment of the pagination should also be appended to the hreflang tags so that the correct translation pages are referenced. The attached change works for me. Is my assumption correct? If so, what is the correct procedure here? Should I make a pull request? /** * Build common metatags not configured via fieldtype. * * @return array */ private function getCommonMetatags() { $baseUrl = $this->seoMaestro->get('baseUrl'); $defaultLang = $this->seoMaestro->get('defaultLanguage') ?: 'en'; $hasLanguageSupportPageNames = $this->wire('modules')->isInstalled('LanguageSupportPageNames'); $tags = ['meta_generator' => '<meta name="generator" content="ProcessWire">']; if ($hasLanguageSupportPageNames) { # page number & prefixes $pageNum = $this->wire('input')->pageNum(); $prefixes = $this->config->pageNumUrlPrefixes; foreach ($this->wire('languages') ?: [] as $language) { if (!$this->page->viewable($language)) { continue; } $code = $language->isDefault() ? $defaultLang : $language->name; $url = $baseUrl ? $baseUrl . $this->page->localUrl($language) : $this->page->localHttpUrl($language); # add pagination segment if ($pageNum > 1) { $prefix = isset($prefixes[$code]) ? $prefixes[$code] : $prefixes['default']; $pageSegment = $prefix . $pageNum; $url = rtrim($url, '/') . '/' . $pageSegment . '/'; } $tags["link_rel_{$code}"] = sprintf('<link rel="alternate" href="%s" hreflang="%s">', $url, $code); if ($language->isDefault()) { $tags['link_rel_default'] = sprintf('<link rel="alternate" href="%s" hreflang="x-default">', $url); } } } return $tags; } Kind regards & many thanks
  4. I could have just used that. Thanks for the information.
  5. Hey, is this feature already in the master branch? Thanks for help
  6. In a multilingual environment I get the following error, wehen sorting menu-items TypeError method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given File: .../modules/MarkupMenuBuilder/ProcessMenuBuilder.module:2602 2602: if($language != null && method_exists($pages->get($itemID)->title, 'getLanguageValue')) $itemTitle = $pages->get($itemID)->title->getLanguageValue($language);// title of each PW page in this array This works for me: // multilingual environments if($language != null && $itemID && method_exists($pages->get($itemID)->title, 'getLanguageValue')) $itemTitle = $pages->get($itemID)->title->getLanguageValue($language);// title of each PW page in this array
  7. hm, there seems to be an error in the latest main branch with PW 3.0.18 ProcessWire\FrontendForms::cleanUpPasswordList(): Argument #1 ($data) must be of type array|string, null given, called in /var/www/html/site/modules/FrontendForms/FrontendForms.module on line 699 search►
  8. Ahh! There it is. Thank you! Maybe you should also integrate it here: https://github.com/juergenweb/FrontendForms/blob/main/Examples/inputfieldexamples.php
  9. Hello @Juergen, is there an example for a file field? In need to upload files via frontend forms, but I could not find anything in the repository. Thanks for Help
  10. Hello @torf, I pushed an update a minute ago. Please have a look, if the issue is resolved. Happy new year.
  11. hej, is it possible to hook into pageViewTracked from ready.php? I tried the following, but since I am not so familiar with hooks, it is not working out. wire()->addHookAfter('PageHitCounter::pageViewTracked', function($pageID) { $page = wire('pages')->get($pageID); ... } Thanks for any help.
  12. Hey Bernhard, Weird! thanks for bug-reporting. I'll update the repository!
  13. Hey everybody, I just uploaded a small textformatter module for wrapping tables with a div container in order to display responsive HTML tables in the frontend. TextformatterWrapTable Processwire wrap table module is a textformatter module for processwire CMS/CMF. It is wrapping markup tables with a div container. wrapping tables with div container simplifies the process of displaying responsive tables in the frontend. The css classes for the wrapper and the table are configurable. .table-responsive / .table by default the module produces the following markup: <div class="table-responsive"> <table class="table"> ... </table> </div> Link to Repository https://github.com/pmichaelis/TextformatterWrapTable
  14. Hi, i wanted to test the module. Is there still a namespacing issue? Error: Class 'ProcessWire\HtmlExporter' not found in /home/vagrant/web/pw-static/web/site/modules/StaticWire/StaticWire.module.php on line 41 thanks for help
  15. Hey Thomas, first of all: thanks for your all the effort you put into the RestApi Module. I've seen the AppApi Module recently and I think it would be good to focus on it. keep it up.
  16. Hey, using the module for the first time. Great work! I don't know if there have been any requests, but is ist possible to make the module work with "Repeater Matrix Fieldtypes"?
  17. Hey, great module. Good work! I think it would be nice for the user to implement explaining textfields for each cookie category and not only titles, because people might not know what they are accepting.
  18. Hey, I searched the forum, but I couldn't find any post with a topic of the problem that I am facing with the module. I setup multilingual menues nd have different roles which have the menu-builder permission. As soon as Editors save a Menu, the custom title translations of the menu are gone. Menu Item titles of the default language are editable as a non-admin user, but all other language titles are ignored / deleted on save. Are only admin users allowed to edit title translations? Thanks for a short hint on that.
  19. Thanks. I'll give it a try
  20. Hey, I keep getting errors when I try to visit the upgrades admin page. I thought it was a memory limit problem and increased the memory, but I still get the errors. /processwire/setup/upgrades/ Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1266 in /var/www/htdocs/wire/core/WireHttp.php) Any hints? Never had problems with the upgrade module.
  21. @thomasaull It is a 1&1 issue. The article here describes it. ? https://www.phpgangsta.de/php-und-http-auth-bei-1und1-webhosting
  22. @thomasaull It seems that the authorisation headers are not present. Added the following line to the htaccess: RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] auth headers are stored in following variable $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; Please don't ask why.
  23. Hey everyone, I did see, that other users were struggling with the problem, that there are no Markers displayed in the frontend, but I could not find any replies to that problem. If I render a map, the coordinates are correct, but the marker icon is not displayed. It displays in the backend, but not in the frontend, also if if but the path to a custom image in the map options. Nothing. Does anyone have the same problem? Thanks for any hints
  24. The jwt auth mechanism is producing errros on a live system. I allready looked for "Wrong number of segments", installed the module again, but the error is still there. Any hints on that? DATUM/ZEIT BENUTZER URL TEXT vor 2 Minuten 2019-03-29 13:22:58 api /api/v1/items Error: Exception: Wrong number of segments (in /cms/site/modules/RestApi/Router.php line 131). File: /cms/index.php:64
×
×
  • Create New...