Skip to content

Instantly share code, notes, and snippets.

@kyletaylored
Created September 26, 2023 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyletaylored/9ec4da1f643a295413765f560da057ad to your computer and use it in GitHub Desktop.
Save kyletaylored/9ec4da1f643a295413765f560da057ad to your computer and use it in GitHub Desktop.
Fix bfi_thumb.php for Pantheon directories
<?php
// Create the upload subdirectory, this is where
// we store all our generated images
if ( defined( 'BFITHUMB_UPLOAD_DIR' ) ) {
$upload_dir .= "/" . BFITHUMB_UPLOAD_DIR;
$upload_url .= "/" . BFITHUMB_UPLOAD_DIR;
} else {
$upload_dir .= "/bfi_thumb";
$upload_url .= "/bfi_thumb";
}
// Patch upload directory value for creating new directories based on manipulations.
$param_hash = md5(implode('', array_values(ksort($params) ? $params : $params)));
$upload_dir .= "/{$param_hash}";
$upload_url .= "/{$param_hash}";
if ( ! is_dir( $upload_dir ) ) {
wp_mkdir_p( $upload_dir );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment