Add data-src to content image

@param string $image
@param int $image_id
@return string
336053
protected function _add_data_src_to_content_image( $image, $image_id ) {
		return preg_replace_callback(
			'@(<img decoding="async"[^>]*?) src="([^"]+?)"([^>]*?>)@m',
			function( $matches ) use ( $image_id ) {
				return sprintf(
					'%s src="%s" data-src="%s" %s',
					$matches[1],
					wp_get_attachment_image_url( $image_id, 'wppso-minimum-thumbnail' ),
					$matches[2],
					$matches[3]
				);
			},
			$image
		);
	}
146925
public function addImage(Image $image)
    {
        // Find the image based on UUID inside the internal state.
        $existingImage = $this->images->findImageByUUID($image->getMediaObjectId());

        if ($existingImage === null) {
            $this->apply(
                $this->createImageAddedEvent($image)
            );
        }
    }
217138
public function process(Image $image, $command_line = '') {
        $result = new Result();

        $result->setCommandLine($command_line . ' -bordercolor ' . escapeshellarg($this->color)
            . ' -border ' . escapeshellarg($this->leftRight . 'x' . $this->topBottom));

        return $result;
    }
344885
public function add($name, $image, $sid = NULL) {
  $setting = new Setting;
  if ($setting->get('tags_need_auth')) {
    $user = new User;
    if ( !$user->isLoggedIn($sid) ) throw new \Exception('Must be logged in to add a tag', 1032);
  }
  if (strlen($name) < 1 OR $name == NULL) throw new \Exception('Tag name cannot be empty');
  if (strlen($image) !== 6) throw new \JohnVanOrange\Core\Exception\Invalid('Invalid image UID');
  $tag = htmlspecialchars(trim(stripslashes($name)));
  $slug = $this->text2slug($tag);
  if ($slug == '') throw new \Exception('Invalid tag name', 1030);
  $blacklist = new Blacklist;
  if ($blacklist->check($slug)) throw new \Exception('Tag has been banned', 1031);
  $query = new \Peyote\Select('tag_list');
  $query->columns('id')
        ->where('basename', '=', $slug);
  $result = $this->db->fetch($query);
  $tag_id = NULL;
  if (isset($result[0]['id'])) $tag_id = $result[0]['id'];
  if(!isset($tag_id)) {
   $tag_id = $this->addtoList($tag);
  }
  //check for dupe
  $query = new \Peyote\Select('resources');
  $query->where('image', '=', $image)
        ->where('value', '=', $tag_id)
        ->where('type', '=', 'tag');
  $result = $this->db->fetch($query);
  if ($result) throw new \Exception('Tag already exists');

  $res = new \JohnVanOrange\Core\Resource('tag', $sid);
  $res->setImage($image)->setValue($tag_id)->setPublic();
  $res->add();

  return [
   'message' => 'Tag added',
   'tags' => $this->get($image)
  ];
 }
382119
def delete_image(self, image_id):
        
        url = self.api_url + '/api/images/' + image_id
        response = self._request_url(url, 'delete', with_access_token=True)
        headers, result = self._parse_and_check(response)
        return Image.from_dict(result)
1170282
public function getImageAsString($image_type = null, $quality = null)
    {
        $string_temp = tempnam('', '');
        $this->save($string_temp, $image_type, $quality);
        $string = file_get_contents($string_temp);
        unlink($string_temp);
        
        return $string;
    }
281875
public function actionDeleteImage(int $id, string $imageType)
    {
        $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY, new CategoryEvent());

        $category = Category::findOne($id);

        if (\Yii::$app->shop_imagable->delete('shop-category/' . $imageType, $category->$imageType)) {
            $category->$imageType = null;
            $category->save();
            Yii::$app->getSession()->setFlash('success', 'The image has been successfully deleted.');
            $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY, new CategoryEvent(['id' => $id]));
        } else Yii::$app->getSession()->setFlash('error', 'Error deleting image.');

        return $this->redirect(\Yii::$app->request->referrer);
    }
1178085
public function editImageStyle($style_id = null)
    {
        $this->setImageStyle($style_id);
        $this->setTitleEditImageStyle();
        $this->setBreadcrumbEditImageStyle();

        $this->setData('imagestyle', $this->data_imagestyle);
        $this->setData('actions', $this->getActionsImageStyle());
        $this->setData('can_delete', $this->canDeleteImageStyle());

        $this->submitEditImageStyle();
        $this->setDataEditImageStyle();

        $this->outputEditImageStyle();
    }
479070
public function picture($id, $name, $email, $thumbnail = true)
	{
		$file = $this->pictureName;

		if ($thumbnail)
		{
			$file = $this->thumbnailName;
		}

		$path = $this->path . DIRECTORY_SEPARATOR . Str::pad($id, 5) . DIRECTORY_SEPARATOR . $file;

		if (file_exists($path))
		{
			return with(new Moderator($path, 'public'))->getUrl();
		}

		return '';
	}
224552
public function uploadImage($image, $filename)
    {
        $requestData = [
            'multipart' => [
                [
                    'name' => 'image',
                    'filename' => $filename,
                    'contents' => $image,
                ],
            ]
        ];

        return $this->client->makeRequest('POST', 'images', $requestData);
    }
862075
public function porn($image, string $image_url = null)
    {
        if ($image_url) {
            return self::image(self::PORN, $image_url, true);
        }

        return self::image(self::PORN, $image);
    }
269708
public function getImage($attachment_id, $size = "post-thumbnail", $placeholder = true)
    {
        $sizes = $this->getConfig("image-sizes");

        if (isset($sizes[$size]) && $placeholder) {
            $image = "//placehold.it/" . $sizes[$size]["width"] . "x" . $sizes[$size]["height"];
        } else {
            $image = false;
        }

        $imgData = wp_get_attachment_image_src($attachment_id, $size);
        if ($imgData && is_array($imgData) && isset($imgData[0]) && $imgData[0]):
            $image = $imgData[0];
        endif;

        return $image;
    }
487154
private function uploadImage(string $purpose, string $imageData) : string
    {
        $parameters = [
            [
                'name' => 'purpose',
                'contents' => $purpose,
            ],
            [
                'name' => 'file',
                'filename' => 'dummy_file_name',
                'contents' => $imageData,
                'headers' => [
                    'Content-Type' => 'image/jpeg'
                ]
            ],
            [
                'name' => 'mimeType',
                'contents' => 'image/jpeg',
            ]
        ];

        $response = $this->postMultiPart(sprintf(self::SATCHEL_ENDPOINT, $this->id()), $parameters);

        return $response->url;
    }
1158314
def image_show(self, image_id):
        '''
        
        '''
        nt_ks = self.compute_conn
        image = nt_ks.images.get(image_id)
        links = {}
        for link in image.links:
            links[link['rel']] = link['href']
        ret = {
            'name': image.name,
            'id': image.id,
            'status': image.status,
            'progress': image.progress,
            'created': image.created,
            'updated': image.updated,
            'metadata': image.metadata,
            'links': links,
        }
        if hasattr(image, 'minDisk'):
            ret['minDisk'] = image.minDisk
        if hasattr(image, 'minRam'):
            ret['minRam'] = image.minRam

        return ret
929134
public function imageToText($image, string $session_id)
    {
        $image = self::encode($image);

        return Request::exec(self::IMAGE_TO_TEXT, compact('image', 'session_id'));
    }
213415
public function update($imagestyle_id, array $data)
    {
        $result = null;
        $this->hook->attach('image.style.update.before', $imagestyle_id, $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $existing = $this->getList();

        if (empty($existing[$imagestyle_id])) {
            return false;
        }

        $saved = $this->config->select('imagestyles', array());

        if (empty($saved[$imagestyle_id])) {
            $data += $existing[$imagestyle_id];
        } else {
            $data += $saved[$imagestyle_id];
        }

        $default = $this->getDefaultData();
        $saved[$imagestyle_id] = array_intersect_key($data, $default);

        $result = $this->config->set('imagestyles', $saved);
        $this->hook->attach('image.style.update.after', $imagestyle_id, $data, $result, $this);
        return (bool) $result;
    }
947411
public function process(Image $image, $command_line = '') {
        $result = new Result();
        $result->setCommandLine($command_line . ' -strip');
        return $result;
    }