Skip to content

Commit a909e3f

Browse files
author
Md. Alimuzzaman Alim
committed
Update class-utility.php
Fix for new upload. Issue #149
1 parent 80653fb commit a909e3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/classes/class-utility.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ public static function get_path_and_url( $metadata, $attachment_id ){
425425

426426
$use_wildcards = self::is_use_wildcards();
427427
$gs_name = apply_filters('wp_stateless_file_name', basename($full_size_path), true, $attachment_id, '', $use_wildcards );
428+
$gs_base_dir = dirname( $gs_name );
428429

429430
if( !isset($metadata['width']) && file_exists($full_size_path) ){
430431
try{
@@ -454,7 +455,8 @@ public static function get_path_and_url( $metadata, $attachment_id ){
454455
foreach( $metadata[ 'sizes' ] as $image_size => $data ) {
455456
if(empty($data[ 'file' ])) continue;
456457
$absolutePath = wp_normalize_path( $base_dir . '/' . $data[ 'file' ] );
457-
$gs_name = apply_filters('wp_stateless_file_name', $data[ 'file' ], true, $attachment_id, $image_size, $use_wildcards);
458+
$gs_name = $gs_base_dir . '/' . $data[ 'file' ];
459+
$gs_name = apply_filters('wp_stateless_file_name', $gs_name, true, $attachment_id, $image_size, $use_wildcards);
458460

459461
$gs_name_path[$image_size] = array(
460462
'gs_name' => $gs_name,

0 commit comments

Comments
 (0)