cloudinary / cloudinary-react

React components that utilize Cloudinary functionality
MIT License
502 stars 219 forks source link

expose path by public id #25

Closed goldylucks closed 7 years ago

goldylucks commented 7 years ago

so we could do:

import { imagePath } from 'cloudinary-react'

<img src={imagePath('myImgPublicIdHere')} />

My use case is to use this inside rendering markdown:

  <ReactMarkdown
    source={`
Some text here ...
![some alt text](${imagePath(myImgPublicIdHere)})
/>`
eitanp461 commented 7 years ago

@goldylucks You can use cloudinary-core which is the foundation underlying Cloudinary's React SDK.

Code snippet:

import cloudinary from 'cloudinary-core';
const cloudinaryCore = new cloudinary.Cloudinary({cloud_name: 'demo'});

const SampleImg = () => (
    <img src={cloudinaryCore.url('sample')} />
);

See full sample here

goldylucks commented 7 years ago

Maybe drop a reference in the docs?

Closing :)

eitanp461 commented 7 years ago

@goldylucks Thank you for the feedback. I will pass it along to the documentation team.