Image placeholder tag

Ed
EdDitto
Posts: 38
Joined: Wed Feb 08, 2012 11:42 pm
Platform: Mac

Mon Apr 02, 2012 11:49 am Post

Hi, folks. I've searched for a topic similar to this and can't find anything, so here's the idea.

It'd be interesting to have a placeholder tag like:

<$image:[image path here]>

Three reasons:

1) To insert graphics into titles/subtitles/headers/footers.
2) Because--as I found recently when working with a document that had over 160 in-text images--working with a lot of images can slow a system down, meaning it'd be nice to see a placeholder for the images in the document view instead of the images themselves.
3) It'd allow automated link-building a la the "Insert / Image Linked to File…" function. For instance, I could hack together a quick Excel spreadsheet that would concatenate image file names and the placeholder tag syntax into an actual tag for copy-and-paste insertion, rather than performing the insert function through the Finder. (The Finder method is fine when all your images are in one location, but when they're spread out it can get a little time-consuming.)

Of course, I don't know whether such an enhancement would be possible to code… :D

Thanks again for such a great product...

Ed

User avatar
KB
Site Admin
Posts: 20775
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Apr 02, 2012 4:27 pm Post

Hi Ed,

I like this idea, and have spent some time today implementing it. From the updated Placeholder Tags List info in the Help menu for the next update:

You can use the <$img…> tag to have images inserted into your text during Compile. This can be useful if you want to insert an image into a title prefix or suffix, if you want to keep images out of the text while writing, or if you want to include certain images only conditionally (you could use the “Replacements” pane of Compile to remove image tags for images you don’t want to appear in a particular Compile format, for instance).
Image tags support image documents that have been imported into the project - in which case you should use the name of the document on its own - or file paths to images on disk. For instance:
<$img:My Image Document>
<$img:~/Pictures/My Image File.png>
(If the image file is stored in the same directory as, or a subdirectory of, the .scriv project, a relative path can be used.)
You can also define the width and height of the image thus:
<$img:My Image Document;w=400;h=200>
As in HTML, specifying only one of either the width or height will cause the other dimension to be scaled proportionally:
<$img:~/Pictures/My Image File.png;w=400>
Remember that the image will use the same formatting as the tag, so if you want the image to be centred with no line spacing, you must format the tag accordingly.


And, using it to insert an image of a line in the title prefix, which I believe is one of the things you were after this:

Image

All the best,
Keith
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
Jaysen
Posts: 6255
Joined: Mon Dec 17, 2007 4:00 am
Platform: Mac + Windows
Location: East-Be-Jesus-Nowhere SC, USA

Mon Apr 02, 2012 4:31 pm Post

Why do you make it so hard to call you a tyrannical and unresponsive developer?
Jaysen

I have a wife and 2 kids that I can only attribute to a wiggle, a giggle, and the realization that she was out of my league so I might as well be happy with her as a friend. 26 years marriage later, I can't imagine life without her. -Me 10/7/09

ImageImage

Ed
EdDitto
Posts: 38
Joined: Wed Feb 08, 2012 11:42 pm
Platform: Mac

Mon Apr 02, 2012 5:35 pm Post

You know, I used to try to make suggestions to the Word development team, but after years of stony silence from them, my suggestions eventually became unprintable.

Here, however, we have same-day service. Nice. The scaling is a thoughtful addition.

Thanks again, Keith...

Ed

User avatar
robertdguthrie
Posts: 3075
Joined: Mon Nov 09, 2009 10:06 pm
Platform: Mac
Location: St. Louis, MO, USA
Contact:

Mon Apr 02, 2012 6:23 pm Post

This is going to save my bacon when I go to compile the final version of a tech document for work... I've been struggling to make images in my document come out only as wide as my page. Since I'm composing this on my Windows machine at work, that means I'll have to put the project on dropbox and mess with it on my Mac at home, but this new tag will make my life far easier than it has been. Hooray!

Would it be possible to use a Scrivener link for the file name in the tag, so that we can click on the link to bring up the image in the other editor or a quick reference window?
Often wrong, rarely in doubt.
Time for a change... I'm now rdale; same dog-avatar, same dog... channel?

User avatar
AmberV
Posts: 24314
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Apr 02, 2012 7:39 pm Post

Sure, since the tag itself is just text you can link it up to whatever you like. In fact I do this a lot with my MMD links (which are similarly just text pointing to a resource; either as a cross-ref or image). Since you'll be using the image name as a part of the link, the link menu will helpfully suggest it at the top so you don't have to drill down through the binder sub-menus to get at it.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

sg
sgn
Posts: 2
Joined: Sun Apr 08, 2012 11:28 am
Platform: Mac
Location: Oakland, CA

Sun Apr 08, 2012 12:23 pm Post

This is my first time on this forum, so please forgive the simplicity of the question. I've read as many posts as possible in the forum to figure out how to get my image placeholder tags to render properly after Compile.

I followed Keith's instructions on creating image tags. All of my images are in my Research folder. Accordingly, I've named the tags as I have the images, i.e., image titled "Architecture" is given the tag Figure <$img:Architecture>.

I've tried variations of this tag <$image:Architecture>, <$img:~/Pictures/Architecture.jpg>. And I linked the relevant images as an internal link to the text document. But after I hit Compile, I don't see my images.

I got this function to work with Scrivener 1 a couple of years ago, but can't seem to get it to work now. I am using Scrivener 2.2, on a Mac (Snow Leopard).

Thanks!
Sylvia

User avatar
KB
Site Admin
Posts: 20775
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Sun Apr 08, 2012 2:16 pm Post

Hi Sylvia,

I'm not sure how you got this working with Scrivener 1.x, as this feature was only added last week. :) As you'll note from my comments in this thread, I have only just implemented it, for the next update (2.3). So it will not work in 2.2. There is a 2.3 beta available for download if you would like to test this feature, though - see the "Beta Testing" sub-forum of the "Scrivener for Mac" forum.

Also, remember that you can insert images into the text in the regular way (by dragging them in from the binder or using Edit > Insert > Image From File...).

All the best,
Keith
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

sg
sgn
Posts: 2
Joined: Sun Apr 08, 2012 11:28 am
Platform: Mac
Location: Oakland, CA

Sun Apr 08, 2012 3:00 pm Post

Hi Keith,
Thanks for the follow-up.

I could've sworn that there was a similar feature in an earlier version of Scrivener. I have this old tag (Figure <$n:figure:figureOfDiamondPlaza>) in one of my text documents that I remember working at some point in the past. How or when I can't say of course. 8)

I look forward to the update.

Best wishes,
Sylvia

User avatar
KB
Site Admin
Posts: 20775
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Sun Apr 08, 2012 3:18 pm Post

That tag works! It's the <$img...> one that's new. There is a list of all tags that work in Help > Placeholder Tags List...
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

ca
cartoonM!ke
Posts: 10
Joined: Sun Jan 13, 2008 6:06 pm
Location: Earth 23
Contact:

Sun Apr 08, 2012 5:53 pm Post

This tag will be so useful. I'm working on modifying the Series Development Bible for use with Comics (mini-series, ongoing series and Graphic Novels) and this tag is perfect for the Character and location parts of the SDB. I plan on using MangaStudio to create the images in and exporting them from (they'll be all the same size and have the same file name, except for the number at the end), so there's going to be a bit of working to see if things can be more automated. But that can wait for another thread and v. 2.3.

Thanks for all the work you guys are doing!
Who would win in a fight -- Schodinger's Cat or Pavlov's Dog?

ma
makfai
Posts: 40
Joined: Tue Oct 01, 2013 11:28 am
Platform: Win + iOS

Thu Oct 03, 2013 11:46 am Post

KB wrote:That tag works! It's the <$img...> one that's new. There is a list of all tags that work in Help > Placeholder Tags List...


There is no list in the Help for Windows.
Using iPADOS and sometimes Windows.