Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FeatureFromSF] Add photos to tags #805

Closed
wolfgang-ch opened this issue Aug 18, 2019 · 23 comments
Closed

[FeatureFromSF] Add photos to tags #805

wolfgang-ch opened this issue Aug 18, 2019 · 23 comments
Assignees
Milestone

Comments

@wolfgang-ch
Copy link
Collaborator

Since I'm using tags for equipment (shoes, mostly, but also other gear), it would be cool to have a photo of the gear with the tag. I'm spoiled by this feature in ST3: nice to see the little icon for the device I'm looking for as well as the description.

Ideally, this photo would be tied in the tag from the "Edit tag" feature and would be able to display in views and selection of tags as well.

Reported by: gregoryx

Original Ticket: mytourbook/feature-requests/153

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 17, 2022

Here is a preview of my draft work for this requested feature:

  • The "Edit Tag" contains a button to upload an image that MT will resize to 70x70 pixels for an optimum display and space savings in the database. We could discuss 100x100 or 50x50 etc...
    image

  • The Tour Data Editor View would contain the list of tags with their image and name.

image

Thoughts ?

I've added @mff73, @stvzldn, @Yannos60 because I know they are/were ST3.1 users and might have suggestions, critics....

@FJBDev FJBDev self-assigned this Nov 17, 2022
@stvzldn
Copy link

stvzldn commented Nov 17, 2022

I would love to have a way to designate a tag as having an "accumulation" property so the tag item could accumulate frequency or time or distance when attached to a tour. Then have a field in the tag structure displaying the property and its value.

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 18, 2022

Not sure to understand the "accumulation" property. You mean displaying the total hours/miles used below the name ?

@stvzldn
Copy link

stvzldn commented Nov 18, 2022

Yes

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 18, 2022

Yes

Ok, I will look into that. I think it should be possible

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 18, 2022

I would love to have a way to designate a tag as having an "accumulation" property so the tag item could accumulate frequency or time or distance when attached to a tour. Then have a field in the tag structure displaying the property and its value.

How does that look for displaying the "accumulation" properties ?

image

@stvzldn
Copy link

stvzldn commented Nov 18, 2022

Very nice display

@wolfgang-ch
Copy link
Collaborator Author

Pictures tell more than text

but the squeezed shoe looks a bit ugly

image

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 19, 2022

Pictures tell more than text

but the squeezed shoe looks a bit ugly

This image is squeezed because as I said above MT will resize to 70x70 pixel and because the picture was not a square in the first place and I didn't want to crop it, it squeezed it. Of course, I am open to suggestions

@wolfgang-ch
Copy link
Collaborator Author

ImageCanvas takes care about the image ratio

final Rectangle imageRect = _image.getBounds();
final Rectangle canvasBounds = getBounds();
final int imageWidth = imageRect.width;
final int imageHeight = imageRect.height;
final int canvasWidth = canvasBounds.width;
final int canvasHeight = canvasBounds.height;
final Point bestSize = UI.getBestFitCanvasSize(//
imageWidth,
imageHeight,
canvasWidth,
canvasHeight);
int bestSizeWidth = bestSize.x;
int bestSizeHeight = bestSize.y;
// ensure image is not enlarged
if (bestSizeWidth > imageWidth || bestSizeHeight > imageHeight) {
bestSizeWidth = imageWidth;
bestSizeHeight = imageHeight;
}
final int offsetX = _isLead ? 0 : (canvasWidth - bestSizeWidth) / 2;
final int offsetY = _isCentered ? (canvasHeight - bestSizeHeight) / 2 : 0;
// draw image
gc.drawImage(_image, //
0,
0,
imageWidth,
imageHeight,
//
offsetX,
offsetY,
bestSizeWidth,
bestSizeHeight);

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 20, 2022

ImageCanvas takes care about the image ratio

So would it be best to store each image in MT's database with the original ratio and have an upper limit of 70pixels for either the width or height ? (for example 70x58 or 43x70 ?)

@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Nov 21, 2022

I would not save any media resources in the tour database, only the absolute/relative path and other metadata when needed, like in net.tourbook.data.TourPhoto

When I would have to save media resouces in a database then I would use a separate database.

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 21, 2022

I would not save any media resources in the tour database, only the absolute/relative path and other metadata when needed, like in net.tourbook.data.TourPhoto

When I would have to save media resouces in a database then I would use a separate database.

An image of 70pixels is only 3KB, it's not possible to save that in the DB ??
image

I can redo my code and not save images but use a file path.
Any other requirements I should know for this feature request so I don't do lots of code that needs to be discarded in the end ?

@wolfgang-ch
Copy link
Collaborator Author

An image of 70pixels is only 3KB, it's not possible to save that in the DB ??

What I don't understand is why you want to save/read images from the database and on the other site, about 900 icon images are already loaded from the file system?

Any other requirements I should know for this feature request so I don't do lots of code that needs to be discarded in the end ?

I've not yet thought in details about this feature but are the tag images static images or can the user select the image from the file system?

I know that creating program code with images can be very time consuming, it took me about one year to implement the photo feature in MT.

You also have to take care about disposing images when they are not needed but the sleak tool https://www.eclipse.org/swt/tools.php can find the leaked images.

@FJBDev
Copy link
Collaborator

FJBDev commented Nov 22, 2022

What I don't understand is why you want to save/read images from the database and on the other site, about 900 icon images are already loaded from the file system?

Because what the users are asking is to display an image for each of their tags. Example: Bike, running shoe, backpack etc.....
I could display from a local file, i just thought that a small 70x70 image (as a byte[]) could easily being save in the DB. But loading it from a local file could work too.

I've not yet thought in details about this feature but are the tag images static images or can the user select the image from the file system?

I know that creating program code with images can be very time consuming, it took me about one year to implement the photo feature in MT.

You also have to take care about disposing images when they are not needed but the sleak tool https://www.eclipse.org/swt/tools.php can find the leaked images.

This feature is actually not really complicated as it consists of displaying an image for each given tag. And indeed disposing each image was a TODO on my list of things for this feature

@wolfgang-ch
Copy link
Collaborator Author

And indeed disposing each image was a TODO on my list of things for this feature

For images which are used at several places in the app, e.g. graph image for elevation, it is difficult to dispose them, for these images there is an image registry net.tourbook.ui.UI.IMAGE_REGISTRY

@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Nov 22, 2022

There is a max number of available image handles (which depends on the OS), so in the image registry not every image should be kept.

image

@cyc1ingsir
Copy link
Contributor

How does that look for displaying the "accumulation" properties ?

With this feature being implemented, I would be able to track used hours and mileage of equipment, right?

That's something, I'd be very interested in and have thought about within the last months.

However, what I'm after is to track quite a few things, especially equipment/parts I'm swapping sometimes from ride to ride (wheel sets, front or rear wheel only, rims, ...) or equipment I'm using for a certain period of time (different chain rings whilst going for a cycling holiday in the Alps.) or just parts needing replacement at a certain time (brake pads and discs, chain, ...),
This becomes a long list containing quite a few items I would have to remember setting the tags for after each tour.

If I think about it, it's a growing list containing almost every part of the bicycle. e.g. Just having had to a replace a broken front derailleur on the last holiday which I now having received back repaired from the manufacturer ready for a new life on the bike.
I'm not sure, this feature request is targeting this use case too.
The thing is. MTB is my central tool for tracking all my cycling activity. If I want to know my mileage done with, the hours spent on my bike, I always looking it up on MTB.
To easily track the equipments/parts data (mileage, hours) the possibility to define the bike's composition at any given time and being able to assign this bike to the tour would be probably best.
I'm not sure if this would be still the scope of _My_TourBook since it's not called My_Equipments_TourBook. But maybe it's not only me having this use case, or one has even come up with an easy solution to this.
Even though, this being integrated within MBT I would like the most.

@FJBDev
Copy link
Collaborator

FJBDev commented Dec 5, 2022

With this feature being implemented, I would be able to track used hours and mileage of equipment, right?

You can already do that as of today, at least I have been since I first used MT back in 2016-2017. Unless I am misunderstanding something ?

That's something, I'd be very interested in and have thought about within the last months.

However, what I'm after is to track quite a few things, especially equipment/parts I'm swapping sometimes from ride to ride (wheel sets, front or rear wheel only, rims, ...) or equipment I'm using for a certain period of time (different chain rings whilst going for a cycling holiday in the Alps.) or just parts needing replacement at a certain time (brake pads and discs, chain, ...), This becomes a long list containing quite a few items I would have to remember setting the tags for after each tour.

That is a different scope than this feature request though. Can you create a separate feature request ?

@FJBDev
Copy link
Collaborator

FJBDev commented Dec 5, 2022

That's something, I'd be very interested in and have thought about within the last months.
However, what I'm after is to track quite a few things, especially equipment/parts I'm swapping sometimes from ride to ride (wheel sets, front or rear wheel only, rims, ...) or equipment I'm using for a certain period of time (different chain rings whilst going for a cycling holiday in the Alps.) or just parts needing replacement at a certain time (brake pads and discs, chain, ...), This becomes a long list containing quite a few items I would have to remember setting the tags for after each tour.

That is a different scope than this feature request though. Can you create a separate feature request ?

Actually, is that what you meant ? Personal/Mechanical performance and bike maintenance

@FJBDev
Copy link
Collaborator

FJBDev commented Feb 10, 2023

Feature implemented as below:

  • For each tag, an image file path can be linked (the image is not saved in the database of MT)

image

  • The image will be displayed in the Tour Data Editor View with the accumulated values of the tag (time and distance used)

image

  • The image will be displayed in the tour contextual menu

image

@FJBDev
Copy link
Collaborator

FJBDev commented Feb 10, 2023

Pictures tell more than text

but the squeezed shoe looks a bit ugly

image

Now it should not be ugly/squeezed anymore as I have changed the resizing to be proportional to the original image's dimensions

image

@FJBDev
Copy link
Collaborator

FJBDev commented Feb 23, 2023

This feature was merged today in main and will be available in MT 23.3

image

image

@FJBDev FJBDev closed this as completed Feb 23, 2023
@FJBDev FJBDev reopened this Feb 23, 2023
@FJBDev FJBDev reopened this Feb 23, 2023
@FJBDev FJBDev closed this as completed Feb 23, 2023
@FJBDev FJBDev modified the milestones: 23.next, 23.3 Feb 23, 2023
FJBDev referenced this issue Mar 20, 2023
…fined in net.tourbook.ui.views.tourDataEditor.TourDataEditorView.STATE_TAG_IMAGE_SIZE_DEFAULT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants