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

Improve media upload #2

Open
maelle opened this issue Jun 17, 2020 · 2 comments
Open

Improve media upload #2

maelle opened this issue Jun 17, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@maelle
Copy link
Collaborator

maelle commented Jun 17, 2020

Current workflow that works but could be improved because it's so fragile

  • I delete all media associated to a post and re-upload everything when I update the post.

  • No longer true 🎉 I also change src of img in the post by using regex (from the relative reference created by rmarkdown to an absolute URL I got from the API after uploading the image) and it should be XPat stuff.

@maelle
Copy link
Collaborator Author

maelle commented Jun 17, 2020

In each folder after the first upload maybe keep track of post ID and hash+name of figures, in .wordpress.yml, in order to see

  • whether the post should be created or updated
  • whether an image needs to be created or updated

Since images are now uploaded with the post as parent, I could also list existing images (in the WordPress gallery) that have the post as parent, and remove those that are no longer needed.

It is very important to not keep old files, because bloating the gallery doesn't sound like a good idea.

maelle added a commit that referenced this issue Jun 18, 2020
@maelle maelle changed the title Add media upload Improve media upload Jun 18, 2020
@maelle maelle added the help wanted Extra attention is needed label Jun 20, 2020
@mdingemanse
Copy link
Contributor

Juggling files through the WP REST API is beyond me but just want to report that the first point in OP doesn't seem to be what happens now: I iterated over a couple versions of a post and did get my gallery bloated. Would be happier with the (brute force) method of deleting, then re-adding everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants