tzwick
Forum Replies Created
-
Thank YOU for your feedback. 256MB is not that much, you are right.
I disabled “Enable chat dashboard and notifications on all admin pages:” in the settings and reduced the memory-limit temporarily for a test.
With the disabled notification on the admin pages it works with 256MB memory limit.
Have a nice day!
Fixed it:
php.ini:
memory_limit = 1024MBut it is a huge amount of memory usage.
Seems like my PHP runs out of memory (256MB).
WP_DEBUG: “Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /path/to/wp-includes/wp-db.php on line 1972”
- This reply was modified 5 years, 5 months ago by tzwick.
There is a way to get the real image size from a JavaScript image object:
var img = document.getElementById('imageid'); var width = img.naturalWidth; var height = img.naturalHeight;
And with PHP:
<?php list($width, $height) = getimagesize("imageURL"); ?>
But this would not be “quick & dirty” ^^
Hi Arno,
until this issue is addressed in the gutenberg-code, I made a quick & dirty workaround with JavaScript that works fine for me:
It modifies the href attributes for the links and sets the data-widht and data-height attributes to “0”. It has to be placed in the footer or at least after the gutenberg gallery html markup:
<!-- modify gutenberg gallery block to display the images in full-size by Thomas Zwick --> <script type="text/javascript"> var galleryLinks = document.querySelectorAll('.blocks-gallery-item > figure > a'); for (var i = 0; i < galleryLinks.length; i++) { var pos = galleryLinks[i].href.lastIndexOf("-"); // get the position of the last "-" var posFileExtension = galleryLinks[i].href.lastIndexOf("."); // get the position of the last "." var fileExtension = galleryLinks[i].href.slice(posFileExtension); // extract file-extension from href galleryLinks[i].href = galleryLinks[i].href.substring(0, pos) + fileExtension; // set the new href attribute to full size galleryLinks[i].setAttribute("data-width", "0"); // set data-width to "0" galleryLinks[i].setAttribute("data-height", "0"); //set data-height to "0" } </script> <!-- end modify gutenberg gallery block -->
I had to disable the function to close the overlay by scrolling in the plugin settings because there were javascript errors with the “0” data-width & data-height attributes.
Hi Arno,
thanks for your reply and the actions you took on github.
Let`s hope this will be solved soon.Kind Regards,
Tom