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

Improvements for the static/image field types #99

Open
jeremydw opened this issue Sep 4, 2020 · 2 comments
Open

Improvements for the static/image field types #99

jeremydw opened this issue Sep 4, 2020 · 2 comments

Comments

@jeremydw
Copy link
Member

jeremydw commented Sep 4, 2020

Should function like a mashup of g.string and google_image fields. Should be a picker (like g.string) but support local file uploads. If file uploads aren't easy to implement, it can be a read-only field.

@Zoramite
Copy link
Member

Zoramite commented Sep 4, 2020

There is a image field type that already does local image uploads. I would need to look at it again to see if it supports the local file selection, but I believe that it should.

@uxder
Copy link
Member

uxder commented Sep 9, 2020

I've confirmed this works.

I have some additional feedback. I can break this out into separate issues if that is easier.

Static Dir

In a new project, attempting to use image doesn't work and throws a JS error. This is because the upload directory /static/img/upload was not set as a static_dir in podspec. The solution wasn't very obvious so I think that should be documented (that you need to set it as a static_dir) or it should be done by default.

Image Overwrites

If the user uploads a local image with the same name, it overwrites the existing one. I feel like we should warn users or create a duplicate.

Example:

  1. I upload an image named moon.jpg.
  2. If I upload another image called moon.jpg, we should warn that there is already one named that or rename this new one to moon-1.jpg

Invalid File Names

Names must be lowercase and only contain letters, numbers, backslashes, and dashes. Found: "/static/img/upload/hello  25.jpg"

It's common for users to try to upload images with spaces or other invalid characters. We should try to clean it up and remove spaces from the filename when uploading.

@Zoramite Zoramite changed the title Add !g.static field type Improvements for the static/image field types Jan 11, 2021
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

No branches or pull requests

3 participants