Categories
General

Post-processing of the image failed – WordPress

PHP Log: [17-Dec-2021 00:59:19 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in \site\wp-includes\functions.php on line 8179

WP Admin Error: Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.

https://wordpress.org/support/topic/files-upload-but-not-in-media-library/page/2/

Som e info about a directory cache, and multisite, added 5.6.0: https://wordpress.org/support/topic/files-upload-but-not-in-media-library/

I simply went to the function that line 8179 of wp-includes/functions.php is in and added a return statemnt as the firsat line of the function. Short term solutuion – dunno if it causes other issues, but my uploader works again. function clean_dirsize_cache( $path ) { … }

Dev Console:
Failed to load resource: the server responded with a status of 524 () asynch-upload.php wordpress multisite

Categories
General

Web.config Basics – What is it?

What is a Web.config file? How do you edit a Web.config file? Here are some Web.config Basics. A Web.config file is used to configure various settings for a website running on Microsoft IIS. It is structured using XML in a file that is separate then your website/application’s code. You can have a single Web.config, or several spread throughout folders on your site – they can assign different permissions, references, application variables, setup caching, and more!

Editing Web.Config in IIS 7
Categories
Code Snippets General PHP Wordpress

[] operator not supported for strings – PHP

I had a problem with Revolution Slider on a WordPress installation when upgrading to PHP 7.2+. It would generate the error – PHP Fatal error: [] operator not supported for strings in C:[path]\wp-content\plugins\revslider\includes\framework\base-admin.class.php:71

The problem was from the plugin attempting to use the short array push syntax on a string:

$box = array();
$box['title'] = $title;
$box['location'] = $location;
$box['content'] = $content;
$box['draw_function'] = $customDrawFunction;
self::$arrMetaBoxes[] = $box;

The solution was to modify the last line as such:

self::$arrMetaBoxes = $box;

No explosions, so all is well!

Why was the operator not supported?

A discussion on Stack Overflow gave me a nudge in the right direction. The suggestion was that PHP 7 has problems with empty-index array push syntax.

These are ok and work properly in PHP 7+.

$undeclared_variable_name[] = 'value'; // creates an array and adds one entry

$emptyArray = []; // creates an array
$emptyArray[] = 'value'; // pushes in an entry

An attempt to use empty index push on any variable declared as a string, number, object, etc, doesn’t works however. ie

$declaredAsString = '';
$declaredAsString[] = 'value';

$declaredAsNumber = 1;
$declaredAsNumber[] = 'value';

$declaredAsObject = new stdclass();
$declaredAsObject[] = 'value';

Theses examples all fail with a PHP error, which in my case was “[] operator not supported for strings”

For more PHP related posts, check here

Categories
Code Snippets General

Display Tiff files on the web

Do you want to display a TIFF image on a webpage? You can learn how here. TIFF files are not made for the web and are not well suited for the web. They used to work in many browsers but as of this writing, support is waning: http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support. TIFF files are very large and contain layer information and are meant to preserve quality so they do not compress well. If you display TIFF files you will hurt your page performance.

However, sometimes situations arise where a client requires that their site display TIFF files, so you have to. But how?

How to Display TIFF Files

Enter UTIF.js which was created for the Photopea online photo editor, therefore this library processes your TIFF files and allows you to display them in HTML.

Display TIFF Files on a Website
This is a TIFF file

You can use TIFF images directly inside the <img> element and then, you just have to to call UTIF.replaceIMG() once at some point. Eg:

<body onload=”UTIF.replaceIMG()”>

<img src=”image.tif” /> <img src=”dog.tif” /> …

Categories
General

Thai Green Curry Paste

  • 1 stalk lemongrass, minced OR 3 Tbsp. prepared frozen or bottled lemongrass (available at Asian stores)
  • 1-3 green chilies, sliced (Thai green chilies OR jalapeno)
  • 1 shallot, sliced, OR 4 Tbsp. minced purple onion
  • 4-5 cloves garlic
  • 1 thumb-size piece of galangal OR ginger, thinly sliced
  • 1/2 cup chopped fresh coriander/cilantro leaves & stems
  • 1/2 cup fresh basil
  • 1/2 tsp. ground cumin
  • 1/2 tsp. ground white pepper (available in most supermarket spice aisles)
  • 1/2 tsp. ground coriander
  • 3 Tbsp. fish sauce; Vegetarians: substitute 1 Tbsp. soy sauce
  • 1 tsp. shrimp paste (available at Asian stores); Vegetarians: substitute 1/2 tsp. salt
  • 2 Tbsp. lime juice
  • 1 tsp. brown sugar
  • 3-4 Tbsp. coconut milk (enough to blend ingredients together)

 

 

 

  1. Place all ingredients in a food processor, chopper, or blender.
  2. Process well to form a fragrant Thai green curry paste. Taste-test it for salt and spice. If too salty, add a squeeze of fresh lime or lemon juice. Add more chili for more heat. Your curry paste is now ready to be used. You can bottle up any leftovers and keep it in the refrigerator for up to 1 week. Freeze thereafter. ENJOY!

Tips:

If using a pestle & mortar (as pictured): Pound all dry herbs & spices together to form a paste, then gradually add the wet ingredients, stirring until smooth.

Your curry paste is now ready to use (see below for cooking tips).
For Vegetarian/Vegan Paste: Instead of fish sauce and shrimp paste, add 1 Tbsp. soy sauce plus 1/3 tsp. salt, as stated in the ingredients list. Alternatively, you could add 3 Tbsp. soy sauce, but this tends to turn the paste brownish-green instead of bright green, as one of the reviewers of this recipe so helpfully noted.

For recipes using this curry paste, see my:, see: Thai Green Curry Chicken Recipe, OR Vegetarian Thai Green Curry (Vegan), OR follow the steps below.

To Make a Thai Green Curry with this Paste (+ More Cooking Tips):

  • Heat a wok or large frying pan or pot over medium-high heat. Add 2-3 Tbsp. oil and swirl around, then add the green curry paste. Stir-fry until fragrant (1 minute), then add 1 cup stock plus your curry ingredients (meat, seafood, or tofu/wheat gluten + vegetables). Simmer until ingredients are cooked, gradually adding 1/2 to 1 can coconut milk until you’re happy with the taste/thickness/amount of sauce.
  • As you’re cooking, you can also add 2-3 kaffir lime leaves (left whole) as well as any leftover lemongrass stalk pieces for even more flavor.
  • When your curry is done, always perform a taste-taste for salt and spice. Add more fish or soy sauce if not salty enough, or some fresh-cut Thai red chilies if not spicy enough (OR add some dried crushed chili). If too spicy, add more coconut milk. If too salty or sweet, add a squeeze of lime juice. If too sour for your taste, add a touch more sugar. Finish your curry by sprinkling over generous amounts of fresh basil.