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
Show Images in posts in an image grid #12334
Show Images in posts in an image grid #12334
Conversation
You will be able to have a look at the current status via my development instance at: |
The It looks pretty good already! |
Hi @MarekBenjamin |
@loma-one Thank you very much for the feedback. I was already made aware about this in this Friendica Support Thread. This will also be one of my questions for going on with this feature:
But I will itemize a few more questions within the next day(s) and post them here altogether. |
Do I understand you correct, that when I craft a blog like entry putting the images at the correct places in the text, this would mean that my posting would look totally different once it is posted, because all the images would then be at the end of the posting? github had a hickup? I just got the question by @loma-one and your reply shown... sorry for the double question then. |
@tobiasd yep, currently this is the case, and one (among many others) of the reasons why it is a draft PR. So at the moment is really only a hack for a proof of concept, which is nevertheless very valuable for me to learn about the code and design patterns. The whole process of searching in the cached HTML for
@MrPetovan partially answered already: #12334 (comment) I might figure it out by my self, but any feedback and inspirations are highly appreciated 👼 |
You should modify the post only at the HTML render. When editing a post users should see exactly what BBCode they entered. |
I see, things start to become clearer. 😄 Are you able to judge if it is better to create the image grid:
|
It depends on the transformation. If it is a localized transformation related to a BBCode tag, please add your changes to I would suggest against a hook, they are needed for optional addons but it sounds like your work would benefit everybody. Also please make sure your changes also work in the vier theme. I recommend you create a delegated account using the vier theme you can switch to and back from your frio-using account, it's easier to switch account than switch theme. |
# Conflicts: # src/Object/Image.php
…_image_presentation # Conflicts: # src/Model/Item.php
Regarding the attachment issue: This is the bbcode from
and the
So, as you see, there is really little semantic available to distinguish between 'inline' images to be kept in place and the 'attached' images I would like to put in an image grid. What are your opinions? I see the following possibilities:
and of course:
Please comment, and if 2. or 3. is favorable: Where should the semantic injection be done? Thank you for your feedback! |
Wouldn't it be much easier, when the whole process was done at an earlier stage and not after the rendering? To clarify this: We already are storing received images from remote networks not directly in the body of the message but as attached media. On incoming Friendica posts (no matter if remote or local) we should easily be able to detect if there were several image links at the bottom of the post. Then we can strip the images from the body. This means that they then will automatically be added via the already existing process of attaching media to the post while rendering. |
Hi @annando , thank you! That was such an important clarification for me, now I get this "attachment" topic finally 👼
and also this location where "incoming" friendica messages are processed? Thank you so much! |
@MarekBenjamin the pictures are currently added in the function |
Thank you so much for offering your support! ❤️ My problem for at least the friendica post is that the images are already included both in I already pushed here an image grid wrapper template The issue is to remove correctly the previously present images in |
Currently, I am elaborating a DOM manipulation for |
I think a general question which needs to be answered is
I think the idea of "all images at the end are assumed to be attached" is already quite good, only that this can be confusing when someone wants to add a "closing image" to its message. |
The change that I want to perform is to remove all images that are added to the end of the body from the body and to add them in the mentioned function. Since images could be posted intentionally at some places, we mustn't remove these images. So the general rule is to not touch the body and the rendered html in any case. Posts from Mastodon (and posts generated via the API) for example shouldn't have image links inside the body. The media in these posts is normally added only in the mentioned function. |
FYI: Added image grid creation to the https://friendica-dev.mbbit.de/display/fa8fe840-2863-8e8b-e42c-410001128098 |
shortened var names added some comments
I think we can start the review phase. I tried a couple of different landscape and portrait mixes and implemented cases to best present those mixes so that both columns are as equal as possible: More landscapes than portraits If you want to support this PR you can - if you are able - check out this branch on your dev instance and play around adding multiple different aspects images and tell me when something is still not handles correctly. Cheers! |
Removed fall back to one column
… for imagegrid style classes, removed id for div
Thank you for your work and your reactivity! |
Hello, this is just a very first draft for this feature. I hope that we can discuss this PR and improve it over time.
I still have a lot of questions, mainly concerning where things can be done.
As you see, in this first attempt, I basically remove all images from a post and reinsert them afterwards using the new
image_grid.tpl
.The point I am most challenged / confused at the moment is the redundancy of
formated-html
in theitem
/body
variable , which seems to be present from the very beginning of the call stack inItem:preparaBody()
method, and the BBcode used in parallel.