integrate iqdbs

This commit is contained in:
Albert Yi
2016-11-30 16:38:00 -08:00
parent ebedea99c1
commit 73ff94e920
3 changed files with 35 additions and 75 deletions

View File

@@ -1,3 +1,4 @@
# todo: move this to iqdbs
class IqdbQueriesController < ApplicationController
before_filter :member_only
@@ -19,14 +20,16 @@ class IqdbQueriesController < ApplicationController
protected
def create_by_url
@download = Iqdb::Download.new(params[:url])
@download.download_and_find_similar
@download.find_similar
@results = @download.matches
render :layout => false, :action => "create_by_url"
end
def create_by_post
@post = Post.find(params[:post_id])
@results = Iqdb::Server.default.query(3, @post.preview_file_path)
render :layout => false, :action => "create_by_post"
@download = Iqdb::Download.new(@post.complete_preview_file_url)
@download.find_similar
@results = @download.matches
render :layout => false, :action => "create_by_url"
end
end