Skip to content

Commit

Permalink
position fix. add API.
Browse files Browse the repository at this point in the history
  • Loading branch information
cherenkov committed Jul 17, 2010
1 parent 4bbe27f commit 6811b4b
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 112 deletions.
33 changes: 31 additions & 2 deletions croppi.rb
Expand Up @@ -3,15 +3,38 @@
require 'sinatra'
require 'base64'
require 'kconv'
require 'net/http'
require 'uri'

# reloader
#require 'sinatra/base'
#require 'sinatra/reloader' if development?
require 'sinatra/base'
require 'sinatra/reloader' if development?


before do
p "@@@@@@@@@@@"
if params[:url] then
uri = URI.parse(URI.encode(params[:url]))
Net::HTTP.start(uri.host) {|http|
res = http.request_get(uri.path)
@api_dataURL = "data:" + res['content-type'] + ";base64," + Base64.encode64(res.body)
}
@api_fileName = File.basename(uri.path).tosjis
end
end



get '/' do
erb :index
end







post '/' do
#適当なチェック
unless params[:imagedata] && params[:filename]
Expand Down Expand Up @@ -39,3 +62,9 @@
#send_fileは内部でhaltするので最後に書く。
send_file("tmp/#{filename}", :disposition => "attachment")
end




#@@@@ マッチしないリクエストは'/'にリダイレクト。

20 changes: 13 additions & 7 deletions public/croppi.css
@@ -1,4 +1,4 @@
#c1 {
#canvas {
display: none;
position: fixed;
bottom: 100px;
Expand All @@ -14,6 +14,7 @@

#zo {
position: relative;
padding-right: 8px; /*大きな画像の場合に右端が少しだけ見えるように*/
}

#area {
Expand Down Expand Up @@ -49,12 +50,19 @@
height: 6px;
}

::selection {
background: translate;
}
::-moz-selection {
background: translate;
}

#footer_menu {
width: 510px;
#footerMenu {
width: 488px;
height: 35px;
display: none;
position: fixed;
bottom: 10px;
bottom: 15px;
z-index: 300;
border-radius: 10px;
-webkit-border-radius: 10px;
Expand All @@ -68,11 +76,9 @@
-o-box-shadow: 5px 5px 5px #000;
-box-shadow: 5px 5px 5px #000;
background-image: url(images/content_bg.gif);
-moz-user-select: none;
-webkit-user-select: none;
}

#footer_menu > div {
#footerMenu > div {
float: left;
}

Expand Down

0 comments on commit 6811b4b

Please sign in to comment.