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

Fix+Chore: Remove crop directives from community post's images #3734

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

Svallinn
Copy link
Member

@Svallinn Svallinn commented Jul 8, 2023

Pull Request Type

  • Other

Description

A picture speaks a thousand words.

Screenshots

Before:
before

After:
after

Desktop

  • FreeTube version: development (ca08562)

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 8, 2023
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) July 8, 2023 02:35
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works but the code looks strange

Also as additional notes I found an answer about this cropping directives removal
https://webapps.stackexchange.com/questions/91659/how-to-view-the-full-background-image-of-a-youtube-channel

In case anyone interested (which at least there would be the future version of myself)

@@ -111,7 +111,8 @@ export default defineComponent({
return Number.parseInt(b.width) - Number.parseInt(a.width)
})

return imageArrayCopy.at(0)?.url ?? ''
// Remove cropping directives when applicable
return imageArrayCopy.at(0)?.url?.replace?.(/-c-fcrop64=[\w,]+/i, '') ?? ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove excess ?.

Suggested change
return imageArrayCopy.at(0)?.url?.replace?.(/-c-fcrop64=[\w,]+/i, '') ?? ''
return imageArrayCopy.at(0)?.url?.replace(/-c-fcrop64=[\w,]+/i, '') ?? ''

@Svallinn Svallinn force-pushed the feat/community-img-cropping-removal branch from 3793ffd to 776d02f Compare July 8, 2023 20:19
@Svallinn
Copy link
Member Author

Svallinn commented Jul 8, 2023

It works but the code looks strange

Also as additional notes I found an answer about this cropping directives removal https://webapps.stackexchange.com/questions/91659/how-to-view-the-full-background-image-of-a-youtube-channel

In case anyone interested (which at least there would be the future version of myself)

Just to clarify, these images have a slightly different link format, they're unamed images.
https://yt3.ggpht.com/s_PAoLivyXmcenxmI5XWWEexj-T9hhCy1OMJLih_Nme2_6hHQDTpvpMEWunuLDreeWCHzBnRVXDy=s715-c-fcrop64=1,64d80000f3d7ffff-nd-v1
You can pretty much remove -c-fcrop64 and everything after it
You can also mess around with the s(\d{3}) portion right behind it (which corresponds to the width you want) to try to get a smaller or bigger image, but I wasn't willing to mess with that, because:

  1. There's no way of knowing what the maximum size you can pull is.
    p.e. An image that is originally 450px in width
    s412 -> image with 412px in width
    s700 -> image with 450px in width (since that's the maximum width of the image)

  2. I'd probably try to improve the UI a bit based on that, but setting div widths based on unknown image sizes is hella finicky and I'm a noob when it comes to manipulating UIs.

If someone who's more confortable with UIs would like to mess around with that, by all means.

@Svallinn Svallinn force-pushed the feat/community-img-cropping-removal branch from 776d02f to 1c07e49 Compare July 8, 2023 20:39
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FreeTubeBot FreeTubeBot merged commit f7b7fe5 into development Jul 9, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 9, 2023
@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc deleted the feat/community-img-cropping-removal branch August 8, 2023 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants