이미지를 문자열로 공유

17695 단어 JavaScriptbase64
이미지를 추가할 수 없는 웹 서비스에 이미지를 추가하려면 URL에 이미지를 문자열(Base64)로 포함하여 이미지를 공유할 수 있습니다.

견본


기본 64에서 이미지 샘플 공유
확인생 URL(※ 장문 주의)
https://tksugimoto.github.io/note/share-images-with-base64/#data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVcAAAD1CAYAAADkkrZJAAAP7ElEQVR4Ae3dMWiV5xoH8KeX2wjHFtJYOEs6FBoDvW5dSgpdRa+DXe7g0kGIk7RLt4II3VwUJwWHLh26eAdbcS0oLm7toAl0aJZAPQ3YCE0HL985OebkJDeJyXkfk7y/giQ5Sd7ne3/P23++857vnPPGi0vTL8J/BAgQIDBSgX+MdDSDESBAgEBXQLhaCAQIECggIFwLoBqSAAECwtUaIECAQAEB4VoA1ZAECBAQrtYAAQIECggI1wKohiRAgIBwtQYIECBQQEC4FkA1JAECBISrNUCAAIECAsK1AKohCRAgIFytAQIECBQQEK4FUA1JgAAB4WoNECBAoICAcC2AakgCBAgIV2uAAAECBQSEawFUQxIgQEC4WgMECBAoICBcC6AakgABAsLVGiBAgEABAeFaANWQBAgQEK7WAAECBAoICNcCqIYkQICAcLUGCBAgUEBAuBZANSQBAgSEqzVAgACBAgLCtQCqIQkQICBcrQECBAgUEBCuBVANSYAAAeFqDRAgQKCAgHAtgGpIAgQICFdrgAABAgUEhGsBVEMSIEBAuFoDBAgQKCAgXAugGpIAAQLC1RogQIBAAQHhWgDVkAQIEBCu1gABAgQKCAjXAqiGJECAgHC1BggQIFBAQLgWQDUkAQIEhKs1QIAAgQICwrUAqiEJECAgXK0BAgQIFBAQrgVQDUmAAAHhag0QIECggIBwLYBqSAIECAhXa4AAAQIFBIRrAVRDEiBAQLhaAwQIECggIFwLoBqSAAECwtUaIECAQAEB4VoA1ZAECBAQrtYAAQIECggI1wKohiRAgIBwtQYIECBQQEC4FkA1JAECBISrNUCAAIECAsK1AKohCRAgIFytAQIECBQQEK4F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jXXWzUCBCoREK6VNNo0CRDIFRCuud6qESBQiYBwraTRpkmAQK6AcM31Vo0AgUoEhGsljTZNAgRyBYRrrrdqBAhUIiBcK2m0aRIgkCsgXHO9VSNAoBIB4VpJo02TAIFcAeGa660aAQKVCAjXShptmgQI5AoI11xv1QgQqERAuFbSaNMkQCBXQLjmeqtGgEAlAv8Dyk2Us0mN5nYAAAAASUVORK5CYII=

↑ 공유된 원본 이미지



구조

  • 이미지를 기본 64로 변환 data:image/png;base64,iVBORw0KGgoAAAANSUh(以下略)
  • URL의 hash 섹션에서 기본 64 문자열 설정 https://tksugimoto.github.io/note/share-images-with-base64/#data:image/png;base64,iVBORw0KGgoAAAANSUh(以下略)
  • 페이지에 URL의hash 부분이 있을 경우 이미지
  • 주의 사항

  • URL이 이미지 크기에 비례하여 길어지기 때문에 글자수 제한이 있는 웹 서비스에서 사용할 수 없음
  • 이미지 크기가 너무 크면hash로 설정할 수 없고 URL은 about:blank
  • 로 변경됩니다.

    좋은 웹페이지 즐겨찾기