Author Topic: BS3 - Are there controls to add custom image?  (Read 2789 times)

Offline Thunky

  • BeerSmith New Brewer
  • *
  • Posts: 1
  • BeerSmith 2 Rocks!
BS3 - Are there controls to add custom image?
« on: June 17, 2018, 07:20:20 AM »
In BS2 there were controls to "Set your own image for this recipe" and "Delete the image set for this recipe" which would replace the beer glass icon and color representation with a specified image file.

Is there a way to do this in BS3?  I have customized images set up in BS2 but am not able to reset to the default image in BS3.

Truthfully, I use this feature to edit recipes at work.  I replace the beer glass with a plain white background so it looks like I'm just working on a boring spreadsheet.  ;-)

Offline BeerSmith

  • Brewer, Author, Patriot
  • BeerSmith Administrator
  • BeerSmith Grandmaster Brewer
  • *****
  • Posts: 5598
  • BeerSmith - take the guesswork out of brewing!
    • BeerSmith
Re: BS3 - Are there controls to add custom image?
« Reply #1 on: June 17, 2018, 10:50:57 AM »
I decided to remove that feature only because it never worked properly with the cloud (the images did not carry over properly) and honestly relatively few people used it.

Get a free trial of BeerSmith 3 here

Offline jcastanes

  • BeerSmith New Brewer
  • *
  • Posts: 2
  • BeerSmith 3 Rocks!
Re: BS3 - Are there controls to add custom image?
« Reply #2 on: July 05, 2018, 01:19:40 PM »
I did the following to add a custom image to my reports, and it also works when you print it out. Unfortunately, it doesn't help in the Design view image.
**I'm a Windows user so this would need to be edited for Mac users. Hopefully someone here can help with the file paths and locations.
[If using BeerSmith2 replace BeerSmith3 with BeerSmith2]

For the Windows version, do the following:
1) Copy your images into the following folder location: C:\Users\[YourUserDirectory]\Documents\BeerSmith3\Reports

2) Add the code below to your Recipe report "NewRecipe.htm" add/or your Brew Steps report "NewBrewsheet.htm". I also use it for my custom reports.

3) In the "Taste Notes" text box, in the "Notes" section, type the file name you want to use with [* in front of the file name and followed with *] after the file name. Do not add a space in front or in back of the file name. (i.e. [*image.jpg*] )

Putting the [* *] around the file name will allow you to still use the "Taste Notes" field for any notes you want to add. If the tags are there, the script will pull it out of the text field regardless of what is in front or behind it and display that image.

The "NewRecipe.htm" and "NewBrewsheet.htm" files are in the C:\Program Files (x86)\BeerSmith3\Reports folder.

You can use note pad to edit the file. I recommend making a backup of the file first. Because of user rights, you may need to copy the file into another directory and then copy & replace the file back into the reports folder. When pasting the code, the format of the text may look different, but it still works.

In the report file, look for:

<img src='$GLASS' style="width:5.3em; height:9em;"/>

and replace it with the following text:

var varTasteNotes = "$TASTE_NOTES";
var varOpen = varTasteNotes.indexOf("[*");
var varClose = varTasteNotes.indexOf("*]");
var varCustomGlass = "";
varCustomGlass = varTasteNotes.substring(varOpen + 2, varClose);   
var varFileExt = varCustomGlass.substring(varCustomGlass.lastIndexOf(".") + 1);
var varGlassSRM = "$GLASS".substring("$GLASS".lastIndexOf("/") + 1);
var varGlass = "file:///C:/Program%20Files%20(x86)/BeerSmith3/icons/" + varGlassSRM;
if (varFileExt == "png" || varFileExt == "jpg" || varFileExt == "gif"){
document.write('<img src=' + varCustomGlass + ' height="115" width="68" />');
} else {
document.write('<img src=' + varGlass + ' height="115" width="68" />');

Hope this works for you, Cheers!
« Last Edit: July 05, 2018, 01:44:25 PM by jcastanes »

Offline sjmcnic

  • BeerSmith New Brewer
  • *
  • Posts: 1
  • BeerSmith 2 Rocks!
Re: BS3 - Are there controls to add custom image?
« Reply #3 on: July 16, 2018, 09:51:50 PM »
I  miss this too from BS2! Used it all the time and never had a problem in the cloud recipe folder not seeing the picture.

Offline Kevin58

  • BeerSmith Grandmaster Brewer
  • *****
  • Posts: 594
  • God is great, beer is good and people are crazy
Re: BS3 - Are there controls to add custom image?
« Reply #4 on: July 19, 2018, 10:54:24 AM »
I wish you could add images to the notes section.
If you?re stressing over homebrewing, you?re doing something wrong.
- Denny Conn