conversion to photoblog based on the 'Photogriffy' photoset on flickr
This commit is contained in:
parent
706315029b
commit
4cd82634f5
8 changed files with 34 additions and 26 deletions
|
@ -13,7 +13,7 @@ class FlickrController < ApplicationController
|
||||||
@pinfo = flickr.photos.getInfo :photo_id => @pid
|
@pinfo = flickr.photos.getInfo :photo_id => @pid
|
||||||
rescue => e
|
rescue => e
|
||||||
flash[:error] = "Photo " + params[:id].to_s + " could not be found. Random photo displayed."
|
flash[:error] = "Photo " + params[:id].to_s + " could not be found. Random photo displayed."
|
||||||
@pid = flickr.photos.search(:user_id => get_user_id).rand.id
|
@pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo.rand.id
|
||||||
@pinfo = flickr.photos.getInfo :photo_id => @pid
|
@pinfo = flickr.photos.getInfo :photo_id => @pid
|
||||||
end
|
end
|
||||||
@psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"}
|
@psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"}
|
||||||
|
@ -25,7 +25,17 @@ class FlickrController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def home
|
def home
|
||||||
@pid = flickr.photos.search(:user_id => get_user_id).rand.id
|
@pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo[0].id
|
||||||
|
@pinfo = flickr.photos.getInfo(:photo_id => @pid)
|
||||||
|
@psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"}
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def random
|
||||||
|
@pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo.rand.id
|
||||||
@pinfo = flickr.photos.getInfo(:photo_id => @pid)
|
@pinfo = flickr.photos.getInfo(:photo_id => @pid)
|
||||||
@psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"}
|
@psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"}
|
||||||
|
|
||||||
|
@ -37,7 +47,7 @@ class FlickrController < ApplicationController
|
||||||
def interesting
|
def interesting
|
||||||
@parray = Array.new
|
@parray = Array.new
|
||||||
|
|
||||||
result = flickr.photos.search(:user_id => get_user_id, :per_page => 20, :sort => "interestingness-desc")
|
result = flickr.photosets.getPhotos(:photoset_id => "72157623178098920", :per_page => 20, :sort => "interestingness-desc").photo
|
||||||
for r in result do
|
for r in result do
|
||||||
@parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source]
|
@parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source]
|
||||||
end
|
end
|
||||||
|
@ -50,7 +60,7 @@ class FlickrController < ApplicationController
|
||||||
def recent
|
def recent
|
||||||
@parray = Array.new
|
@parray = Array.new
|
||||||
|
|
||||||
result = flickr.photos.search(:user_id => get_user_id, :per_page => 20)
|
result = flickr.photosets.getPhotos(:photoset_id => "72157623178098920", :per_page => 20).photo
|
||||||
for r in result do
|
for r in result do
|
||||||
@parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source]
|
@parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
<% for p in @parray do %>
|
<div class="box">
|
||||||
<div class="thumb"><%= link_to image_tag(p[:source], :alt => p[:id]), :action => 'photo', :id => p[:id] %></div>
|
<div class="border" style="width:450px;height:550px;">
|
||||||
<% end %>
|
<% for p in @parray do %>
|
||||||
|
<div class="thumb"><%= link_to image_tag(p[:source], :alt => p[:id]), :action => 'photo', :id => p[:id] %></div>
|
||||||
|
<% end %>
|
||||||
|
<h1><%= controller.action_name %></h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,4 +1,5 @@
|
||||||
<% if (@psize && @pinfo && @pid ) then %>
|
<% if (@psize && @pinfo && @pid ) then %>
|
||||||
<%= link_to image_tag(@psize.source, :alt => @pinfo.title), :controller => "flickr", :action => "photo", :id => @pid %>
|
<%= link_to image_tag(@psize.source, :alt => @pinfo.title), :controller => "flickr", :action => "photo", :id => @pid %>
|
||||||
<p><%= @pinfo.title %></p>
|
<p><%= @pinfo.title %></p>
|
||||||
|
<p style="font-size:smaller;"><%= @pinfo.description %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
<div class="box">
|
<%= render :partial => "grid" %>
|
||||||
<div class="border" style="width:450px;height:600px;">
|
|
||||||
<%= render :partial => "grid" %>
|
|
||||||
<h1>most interesting photos</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
<div class="box">
|
<%= render :partial => 'grid' %>
|
||||||
<div class="border" style="width:450px;height:550px;">
|
|
||||||
<%= render :partial => 'grid' %>
|
|
||||||
<h1>most recent photos</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="border" style="width:500px;padding-left:25px;padding-right:25px;text-align:left;">
|
<div class="border" style="width:500px;padding-left:25px;padding-right:25px;text-align:left;">
|
||||||
<h1 style="text-align:center;">about</h1>
|
<h1 style="text-align:center;">about</h1>
|
||||||
<p>this is just a simple site I use to showcase flickr photos and uploaded screenshots
|
<p>welcome to another little home of mine on the web.</p>
|
||||||
from <a href="http://www.realmacsoftware.com/littlesnapper/">little snapper</a>.</p>
|
<p>i've wanted a photoblog for some time now, so this is what i've coded up to fill that void.</p>
|
||||||
<p>i may consider open sourcing it later, but it's not anything that someone of average
|
<p>also take a look at my <a href="http://amdavidson.com">blog</a> and my <a href="http://amdavidson.me">lifestream</a>.</p>
|
||||||
rails ability couldn't do in a couple of hours.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -18,7 +18,8 @@
|
||||||
<h1>photogriffy.net</h1>
|
<h1>photogriffy.net</h1>
|
||||||
<p>
|
<p>
|
||||||
<%= link_to "about", {:controller => "info", :action => "about"}, :alt => "about" %> |
|
<%= link_to "about", {:controller => "info", :action => "about"}, :alt => "about" %> |
|
||||||
<%= link_to "random", {:controller => "flickr", :action => "home"}, :alt => "reload" %> |
|
<%= link_to "current", {:controller => "flickr", :action => "home"}, :alt => "current" %> |
|
||||||
|
<%= link_to "random", {:controller => "flickr", :action => "random"}, :alt => "random" %> |
|
||||||
<%= link_to "recent", {:controller => "flickr", :action => "recent"}, :alt=> "recent" %> |
|
<%= link_to "recent", {:controller => "flickr", :action => "recent"}, :alt=> "recent" %> |
|
||||||
<%= link_to "interesting", {:controller => "flickr", :action => "interesting"}, :alt => "interesting"%>
|
<%= link_to "interesting", {:controller => "flickr", :action => "interesting"}, :alt => "interesting"%>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -44,13 +44,15 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
map.connect 'u/:user_id/p/:id', :controller => "flickr", :action => "photo", :requirements => { :user_id => /.*/ }
|
map.connect 'u/:user_id/p/:id', :controller => "flickr", :action => "photo", :requirements => { :user_id => /.*/ }
|
||||||
map.connect 'u/:user_id', :controller => "flickr", :action => "home", :requirements => {:user_id => /.*/}
|
map.connect 'u/:user_id', :controller => "flickr", :action => "home", :requirements => {:user_id => /.*/}
|
||||||
|
|
||||||
map.connect 'r', :controller => "flickr", :action => "recent"
|
map.connect 'recent', :controller => "flickr", :action => "recent"
|
||||||
map.connect 'i', :controller => "flickr", :action => "interesting"
|
map.connect 'random', :controller => "flickr", :action => "random"
|
||||||
|
map.connect 'interesting', :controller => "flickr", :action => "interesting"
|
||||||
map.connect 'p/:id', :controller => "flickr", :action => "photo"
|
map.connect 'p/:id', :controller => "flickr", :action => "photo"
|
||||||
|
|
||||||
map.connect 's/i', :controller => "screenshot", :action => "index"
|
map.connect 's/i', :controller => "screenshot", :action => "index"
|
||||||
map.connect 's/:filename', :controller => "screenshot", :action => "single", :requirements => { :filename => /.*/ }
|
map.connect 's/:filename', :controller => "screenshot", :action => "single", :requirements => { :filename => /.*/ }
|
||||||
|
|
||||||
|
map.connect 'about', :controller => "info", :action => "about"
|
||||||
map.connect 'o/:action', :controller => "info"
|
map.connect 'o/:action', :controller => "info"
|
||||||
|
|
||||||
map.root :controller => "flickr", :action => "home"
|
map.root :controller => "flickr", :action => "home"
|
||||||
|
|
Loading…
Reference in a new issue