Guest User

Untitled

a guest
Mar 17th, 2021
13
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function get_translated_image_by_url( $img_src, $source_language, $target_language ){
  2.  
  3. $attachment_id = $this->get_attachment_image_from_guid($img_src, $source_language);
  4. if (!$attachment_id) {
  5. $attachment_id = $this->get_attachment_image_from_meta($img_src, $source_language);
  6. }
  7. if ($attachment_id){
  8. $size = $this->get_image_size_from_url($img_src, $attachment_id);
  9.  
  10. return $this->get_translated_image($attachment_id, $target_language, $size);
  11. } else {
  12. return $img_src;
  13. };
  14. }
RAW Paste Data