Skip to main content

encode_image_mixin

Function encode_image_mixin 

Source
pub fn encode_image_mixin(image: &ImageSpec) -> Result<Vec<u8>, ContentError>
Expand description

Encode an ImageSpec into the ImageMixinMessage payload bytes.

Returns an error if the image digest hex or any mipmap CID is malformed, rather than silently encoding an empty ipfs_hash. A bad image reference must fail the whole publish so it can never land on-chain.

§Errors

Fails with crate::ContentError::Cid when the image’s digest_hex is not 32 bytes of 0x hex (via [multihash_bytes]) or any mipmap level’s cid is not a sha2-256 CIDv0 multihash (via [cid_to_multihash_bytes]).