Hi,Is there a way to add a photo to an activity (eg to remember a place on the course)?
If this feature does not exist, are there any plans to add it?
I opened a feature request here 6 months ago, no reaction on this topic :/
I didn't expect anything
My English is basic, I write this because it is, that's all :)
Going back to the subject of the thread, it would be really great to see this feature added, it's the only thing I really miss in GC.
Hi, I also would love the feature. Is this planned?
Thank you for your detailed explanation. I'm sorry that my question had a demanding tone.
I tried a workaround with a tab website where you can also point to local files. But this is not activity specific, the same foto is shown in all activities.
##Activity Images by Olivier 01-2024
##There must be a details tab "Images" with text fields named "Image_1" to "Image_10"
##Enter the file path to the images in the text fields (windows: shift rightclick on image, copy path)
colc=0
colnr=0
# Save paths to variables
activity = GC.activity()
img1 = GC.activityMetrics()['Image_1']
img2 = GC.activityMetrics()['Image_2']
img3 = GC.activityMetrics()['Image_3']
img4 = GC.activityMetrics()['Image_4']
img5 = GC.activityMetrics()['Image_5']
img6 = GC.activityMetrics()['Image_6']
img7 = GC.activityMetrics()['Image_7']
img8 = GC.activityMetrics()['Image_8']
img9 = GC.activityMetrics()['Image_9']
img10 = GC.activityMetrics()['Image_10']
# check if paths are given. If not the html img src is empty
if img1 != "":
imgt1 = """<img src=""" +img1+""" max-width: 60%>"""
colc=colc+1
else:
imgt1=""
if img2 != "":
imgt2 = """<img src=""" +img2+""" max-width: 60%>"""
colc=colc+1
else:
imgt2=""
if img3 != "":
imgt3 = """<img src=""" +img3+""" max-width: 100%>"""
colc=colc+1
else:
imgt3=""
if img4 != "":
imgt4 = """<img src=""" +img4+""" max-width: 100%>"""
colc=colc+1
else:
imgt4=""
if img5 != "":
imgt5 = """<img src=""" +img5+""" max-width: 100%>"""
colc=colc+1
else:
imgt5=""
if img6 != "":
imgt6 = """<img src=""" +img6+""" max-width: 100%>"""
colc=colc+1
else:
imgt6=""
if img7 != "":
imgt7 = """<img src=""" +img7+""" max-width: 100%>"""
colc=colc+1
else:
imgt7=""
if img8 != "":
imgt8 = """<img src=""" +img8+""" max-width: 100%>"""
colc=colc+1
else:
imgt8=""
if img9 != "":
imgt9 = """<img src=""" +img9+""" max-width: 100%>"""
colc=colc+1
else:
imgt9=""
if img10 != "":
imgt10 = """<img src=""" +img10+""" max-width: 100%>"""
colc=colc+1
else:
imgt10=""
# Count Nr of Images to dynamically adjust colums
if colc < 3:
colnr=1
if colc > 2 and colc < 7:
colnr=2
if colc > 6:
colnr=3
# create a temporary html file and fill it
import tempfile
tmp=tempfile.NamedTemporaryFile(delete=False)
path=tmp.name+'.html'
f=open(path, 'w')
txt=f"""
<html>
<head>
<style>
div {{
max-width: 1200px;
margin: 0 auto;
}}
#photos {{
line-height: 0;
-webkit-column-count: {colnr};
-webkit-column-gap: 10px;
-moz-column-count: {colnr};
-moz-column-gap: 10px;
column-count: {colnr};
column-gap: 10px;
}}
#photos img {{
width: 100%;
height: auto !important;
margin-bottom: 10px;
}}
@media (max-width: 1200px) {{
#photos {{
column-count: {colnr};
}}
}}
@media (max-width: 980px) {{
#photos {{
column-count: {colnr};
}}
}}
@media (max-width: 640px) {{
#photos {{
column-count: {colnr};
}}
}}
</style>
</head>
<body style="background-color:black;">
<div>
<section id="photos">
{imgt1}
{imgt2}
{imgt3}
{imgt4}
{imgt5}
{imgt6}
{imgt7}
{imgt8}
{imgt9}
{imgt10}
</section>
</div>
</body>
</html>
"""
# write the html file to the GC.webpage
f.write(txt)
f.close()
GC.webpage('file://' + path)
print("no errors")
In fact Medien there would be a fourth solution.....pass to intervals.icu.
Mr. @Ale Martinez is rude ,opinionated and his only a response is always....read the wiki......,
he does not appreciate those who are not able to program like him.
Leave GC as I did ( because of Martinez ) and switch to intervals.icu, which you can browse online from any device, the founder is available to requests from EVERYONE and the community is rich in insights
GC is free only on paper....in reality he makes changes only if they interest him
Thanks a lot Medien,
I hadn’t thought at all about using a Python chart; that’s a great idea.
I modified your script so that there’s no need to create text fields or copy/paste the image path, it dynamically takes all the images present in the directory.
The only rule to follow is to place the images in a folder named after according to the activity date (example: 2024-01-26).
You need ta adapt imgdir variable.
I hadn’t read all the comments. Thanks Alé for the idea!!!
Here’s an improved version that displays a CSS gallery.
If there are no photos for the activity, it will show:
If there are photos present:
and in gallery mode:
Last version, no need to modify “imgdir”.
If not exist, it will create a folder “Images” in GoldenCheetach user home directory inside “Media”.
By default it will tell you how to upload your images.
I prefer to store the images in the GoldenCheetach user home directory directory as they will be included in profile backups.
import os import tempfile # If it not exist, a folder named Images will be create # in GoldenCheetah user home inside "Media". user_home = GC.athlete()['home'] imgdir = "{}/media/Images".format(user_home) if not os.path.exists(imgdir): os.makedirs(imgdir) m = GC.activityMetrics() date = m['date'] time = m['time'] sport = m['Sport'] title = m['Workout_Title'] def list_images(dir): imglist = "" col = 0 if not os.path.exists(dir): path = imgdir + "/" + str(date) return ("""<p>No images for this activity. <br>Add them to the directory <i><a href="{}"> {}*</a></i> to link them to this activity.</p> <h5>*Copy photo folder path with "Right clic" -> "Copy link adress"</h5> """.format(path, path), 0) files = os.listdir(dir) ext = [".jpg", ".jpeg", ".png", ".gif", ".bmp"] images = [file for file in files if any( file.lower().endswith(ext) for ext in ext)] for image in images: img_path = os.path.join(dir, image) col += 1 imglist += """ <a href="#img{}"> <img class="thumb" src="{}"> </a> <div class="lightbox" id="img{}"> <a href="#img{}" class="light-btn btn-prev">prev</a> <a href="#_" class="btn-close">X</a> <img src="{}"> <a href="#img{}" class="light-btn btn-next">next</a> </div> """.format(col, img_path, col, col-1, img_path, col+1) return (imglist, col) imgrootdir = "{}/{}".format(imgdir, date) imglist, col = list_images(imgrootdir) # create a temporary html file and fill it tmp = tempfile.NamedTemporaryFile(delete=False) path = tmp.name+'.html' f = open(path, 'w') txt = f""" <!DOCTYPE html> <html> <title>{title}</title> <head> <style> html, body {{ font-family: arial; padding: 0 2em; font-size: 18px; background: #111; color: #aaa; text-align: center; }} h1 {{ font-size: 2em; font-weight: 100; }} p {{ font-weight: 100; color: #888; margin-bottom: 45px; }} a {{ color: hotpink; }} .thumb {{ max-height: 171px; border: solid 6px rgba(5, 5, 5, 0.8); }} .lightbox {{ position: fixed; z-index: 999; height: 0; width: 0; text-align: center; top: 0; left: 0; background: rgba(0, 0, 0, 0.8); opacity: 0; }} .lightbox img {{ max-width: 90%; max-height: 80%; margin-top: 2%; opacity: 0; }} .lightbox:target {{ outline: none; width: 100%; height: 100%; opacity: 1 !important; }} .lightbox:target img {{ border: solid 17px rgba(77, 77, 77, 0.8); opacity: 1; webkit-transition: opacity 0.6s; transition: opacity 0.6s; }} .light-btn {{ color: #fafafa; background-color: #333; border: solid 3px #777; padding: 5px 15px; border-radius: 1px; text-decoration: none; cursor: pointer; vertical-align: middle; position: absolute; top: 45%; z-index: 99; }} .light-btn:hover {{ background-color: #111; }} .btn-prev {{ left: 7%; }} .btn-next {{ right: 7%; }} .btn-close {{ position: absolute; right: 2%; top: 2%; color: #fafafa; background-color: #92001d; border: solid 5px #ef4036; padding: 10px 15px; border-radius: 1px; text-decoration: none; }} .btn-close:hover {{ background-color: #740404; }} </style> </head> <body> <h1>{title}</h1> <p>{sport} {date} {time}</p> {imglist} </body> </html> """ # write the html file to the GC.webpage f.write(txt) f.close() GC.webpage('file://' + path)Medien,
Here is an update version using Path from pathlib, it should deal with Windows path as well.
Could you try and tell me if it's OK on Windows ?
What is the pink path displayed ?
Last version, no need to modify “imgdir”.
If not exist, it will create a folder “Images” in GoldenCheetach user home directory inside “Media”.
By default it will tell you how to upload your images.
a future gallery in Overview can be made backward compatible with this one.
Could you try and tell me if it's OK on Windows ?
On Friday 26 January 2024 at 23:57:28 UTC Ale Martinez wrote:a future gallery in Overview can be made backward compatible with this one.I think there are at least 3 bits of code needed:1) drag and drop an image into a ride should save it into the media folder and add the filename to a metadata tag (; delimetered list of media)
Hi,
alternative example with plotly (Py chart 04)Drag and drop or copy as path (files ----> Data->Images)
image=am['Image'].replace('"','').split()
image=[prefix+img for img in am['Images'].split()]
Thanks a lot Ale and Mark, nice feature, I will update my chart to use these new fields.
About Workout_Title, maybe this is something I've added or I've been using from an old version.
Which field do you use for the activity title? Workout_Code ?
Currently both are included in default metadata layout, but I think Workout Code is more common in general and Workout Title for users coming from WKO/Training Peaks, IIRC.
On Wednesday 31 January 2024 at 01:53:30 UTC Ale Martinez wrote:
Currently both are included in default metadata layout, but I think Workout Code is more common in general and Workout Title for users coming from WKO/Training Peaks, IIRC.
Workout Code is definitely a generalised thing, but it is also available in WKO and mapped across.Workout Title was introduced to map from TrainingPeaks and then Strava with a view to it being a loger version
e.g. Workout Code "2x20" to Workout Title "Threshold Intervals 2x 20 minutes"
But then everyone has their own scheme for this !
PS: I will add a gallery widget sometime and make it possible to associate an image with an interval (primarily for Aero testing where the rider position is useful when looking at the data)
Mark
--
_______________________________________________
Golden-Cheetah-Users mailing list
golden-che...@googlegroups.com
http://groups.google.com/group/golden-cheetah-users?hl=en
---
You received this message because you are subscribed to the Google Groups "golden-cheetah-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golden-cheetah-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golden-cheetah-users/6600f192-85da-4657-83e4-8fb56b3b48adn%40googlegroups.com.
image=[prefix+img for img in GC.getTag('Images').split()]
in the above chart script makes it to work with the new scheme.
Hi Ale, quick update :## 1) Title (Sport)
## 2) Filename (mouseover image)
## 3) Margin
Problems with spaces in file names.
This all looks great. and it looks from the release notes like the 3.7 DEV supports it, but but I don't understand how to do it (the drag and drop seems to do something, but I don't see any photos). I don't find a tile to add, or whatever needs to be done.It would be great if someone who understands it would be willing to add instructions to the FAQ.- Rich
I have added a short guide to the FAQ
I have adapted the guide. Now it is with the note that the chart in v3.7 is a standard chart.Data field is now for maintaining the images.If possible, I would like to add two pictures and a short video to the guide.The data can be found in the attached zip file.
I made a small update to the image chart. Now the chart can handle filenames with spaces.Changed the date to the local date with the weekday.Added a description to the Path.
I pushed another fix (https://github.com/GoldenCheetah/GoldenCheetah/commit/62993743d9870fab8cca8048fc51913dec4bcf66) so the Images chart is updated after import.The combination of the last 2 changes enables the more intuitive drag-n-drop over the Images gallery chart with immediate update, this will be available in May snapshot builds.
Hi Ale,drag and drop is perfect now, thanks.I added some options :1) Dragmode ( mouse 'mpointer' = 'pan' or 'zoom' , now default is 'pan' )2) Show notes ( 'notes' = True or False .... if it helps)
Write notes in the field 'Data->Images->ImgNote'.3) Open save folder ( 'opnimg' = True or False , default False)