Skip to content

Instantly share code, notes, and snippets.

@michalkorzawski
Created October 30, 2022 22:33
Show Gist options
  • Save michalkorzawski/510e24a48c66cf90143ab569601cb654 to your computer and use it in GitHub Desktop.
Save michalkorzawski/510e24a48c66cf90143ab569601cb654 to your computer and use it in GitHub Desktop.
# app/controllers/images_controller.rb
class ImagesController < ApplicationController
skip_before_action :verify_authenticity_token, only: :convert_heic
def convert_heic
tempfile = ImageConverter.new(tempfile: params[:image].tempfile, height: 400).call
render json: tempfile.read, content_type: 'image/jpg'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment