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

Remove Cloudinary #4199

Closed
furilo opened this issue Feb 12, 2024 · 6 comments · Fixed by #4204
Closed

Remove Cloudinary #4199

furilo opened this issue Feb 12, 2024 · 6 comments · Fixed by #4204
Assignees

Comments

@furilo
Copy link
Member

furilo commented Feb 12, 2024

Analyze if we can get rid of the Cloudinary service. Review what is currently doing, and see if we can use some local JS to do the same.

If I'm not wrong, it is only used to crop and resize images for https://gobierto.readme.io/docs/altos-cargos-y-agendas#crear-y-editar-una-persona

Related: https://appsignal.com/populate/sites/5ebb88520264445dc7e68b5c/exceptions/incidents/4244/samples/timestamp/2024-02-12T08:46:02Z

@Crashillo
Copy link
Member

It's used in several admin forms. Indeed, it looks like a wrapper of the file-uploader function (to edit images) whether your file fulfills some requirements (i.e. bigger than expected).

Cloudinary returns a url with the file. The current code (6-7 yo) were prepared to handle these urls also. App signal points to

tmp_file.write(open(url).read)

so, according to @entantoencuanto is possible that clause have become deprecated by some newer ruby/rails versions. IMO, it'd would be better deal with such issue only than to try a full library replacement, all in all, it would be use a js library instead

@furilo
Copy link
Member Author

furilo commented Feb 19, 2024

I don't understand - can we get rid of it or no?

@Crashillo
Copy link
Member

Nope, it's better and easier to solve the current issue

@furilo
Copy link
Member Author

furilo commented Feb 19, 2024

We want to get rid of the service, because its a service, and not just a library.

Outline where are we using it and for what, and which feature we'd need to replace, and what library we could use.

@Crashillo
Copy link
Member

Crashillo commented Feb 19, 2024

GobiertoAdmin::CloudinaryService is used in GobiertoAdmin::FileUploadService in turn, is used in:

  • app/forms/concerns/gobierto_common/dynamic_content_form_helper.rb
  • app/forms/gobierto_admin/file_attachment_form.rb
  • app/forms/gobierto_admin/site_form.rb
  • app/forms/gobierto_admin/gobierto_people/person_form.rb
  • app/forms/gobierto_admin/gobierto_people/person_statement_form.rb

A frontend alternative that looks the better is https://fengyuanchen.github.io/cropperjs/v2/

We would need to append a data-attribute to the current <input type="file" /> on each form (to these mentioned, or in general) to launch the cropper, and then adapt the cropper output (i.e the way this library deal with the images, the HTML result) to the current one in order to save the form properly

@furilo
Copy link
Member Author

furilo commented Feb 19, 2024 via email

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 a pull request may close this issue.

2 participants