Src of an image with text + php variable

198
July 08, 2021, at 02:10 AM

Hey i am having a hard time getting this to work I used this code

to upload images as base64 and then show them with the order details everything is okay and the image is uploaded but I can't show the image uploaded

this is the function

/**
 * Add order item meta.
 */
add_action( 'woocommerce_add_order_item_meta', 'add_order_item_meta' , 10, 2);
function add_order_item_meta ( $item_id, $values ) {
    if ( isset( $values [ 'custom_data' ] ) ) {
      save_image($custom_data);
      $image =  " <img src='https://mywebsite.com/wp-content/uploads/2021/07/ .$hashed_filename' >";
      wc_add_order_item_meta( $item_id, 'Image', $image );
        
    }
}

After testing that the image only shows the link without the variable

as I saw on google, I need to add echo before the variable, but I can't because it will be saved in a variable for that function ($image)

Answer 1

you can try this

$image =  "<img src='https://mywebsite.com/wp-content/uploads/2021/07/" . $hashed_filename . "'>";
READ ALSO
HI i like to spin this star i created and move it across canvas in javascript [closed]

HI i like to spin this star i created and move it across canvas in javascript [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post

28
How to add data that sequentially increases by 1 by adding a new column to existing data using Python

How to add data that sequentially increases by 1 by adding a new column to existing data using Python

Using Python, I am trying to put data that is sequentially incremented by 1 in the newly added 'legendary' column to the existing data

142