Ihor Radchenko <yanta...@posteo.net> writes: > Björn Bidar <bjorn.bi...@thaodan.de> writes: > >>> Both alignment and width are derived from LINK AST node. >>> I am not sure what is the problem. >>> AFAIU, Karthik is simply asking why you decided to calculate alignment >>> from LINK, but not width. >> >> My question was because the width is set through the width of the inline >> image, i.e. the image-data passed through the preview function. >> Is there no difference if function using org-link-review-image-data has >> not set the width of the image and then we set the with of the overlay >> instead? > > You are probably confused by `org--create-inline-image'?
Possibly but I simply was confused by some of the properties of the overlay being set and some of them being taken from the image object. > IMHO, it would be best to pass image file name/raw image data to > `org-link-preview-image-data', not an image object and call > `org--create-inline-image' from inside `org-link-preview-image-data'. > That way, we can automatically obey Org customization wrt image > alignment, image width, and image max width. For that case using org-link-preview-file should be sufficient? >>> If we think about the API function to be more useful, we can derive >>> alignment and width from LINK itself by default, but also provide >>> optional parameters, so that the caller can override the values >>> manually. If both alignment and width parameters are explicitly >>> specified, LINK does not have to be provided. >> >> How would that work? Make link align and with optional and fail if >> align or with are missing without link? > > Yes.