Skip to content

Commit

Permalink
Update wcpdf-functions.php
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Jun 27, 2024
1 parent 0bc16a9 commit ff241e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/wcpdf-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,15 @@ function wpo_wcpdf_get_image_mime_type( string $src ): string {
}

/**
* Base64 encode image from URL or local path
* Base64 encode file from URL or local path
*
* @param string $src
*
* @return string|bool
*/
function wpo_wcpdf_base64_encode_image( string $src ) {
$image_data = @file_get_contents( $src );
return base64_encode( $image_data ) ?? false;
function wpo_wcpdf_base64_encode_file( string $src ) {
$file_data = @file_get_contents( $src );
return base64_encode( $file_data ) ?? false;
}

/**
Expand Down Expand Up @@ -899,7 +899,7 @@ function wpo_wcpdf_get_image_src_in_base64( string $src ): string {
return $src;
}

$image_base64 = wpo_wcpdf_base64_encode_image( $src );
$image_base64 = wpo_wcpdf_base64_encode_file( $src );

if ( ! $image_base64 ) {
wcpdf_log_error( 'Unable to encode header logo to base64.', 'critical' );
Expand Down

0 comments on commit ff241e5

Please sign in to comment.