phpはネット上の画像をダウンロードしてbase 64に変換します


/**
	* @name       base64  
	* @ $image_file         ,     
	* @ $base64_image     base64       
	*/
	public function base64EncodeImage ($image_file) { 
		$base64_image = ''; 
		$image_info = getimagesize($image_file); 
		$image_data = fread(fopen($image_file, 'r'), filesize($image_file)); 
		$base64_image = 'data:' . $image_info['mime'] . ';base64,' . chunk_split(base64_encode($image_data)); 
		return $base64_image;
	}
    
    /*
     * @name       ,     
     */
    function download($url, $path = './uploads/images/')
	{
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
		$file = curl_exec($ch);
		curl_close($ch);
		$filename = pathinfo($url, PATHINFO_BASENAME);
		$resource = fopen($path . $filename, 'a');
		fwrite($resource, $file);
		fclose($resource);
		return $path.$filename;
	}
  

ウェブサイトでは画像が多すぎて、開く速度が遅いのでbase 64を使うのが解決策ですが、検索エンジンに友好的かどうかは分かりません...