Skip to main content

Seach public pics on flicker

While blogging, I keep needing images that I can use. Though I have no issue using proprietary one from google, however it would be best if I could put flickr to some use and develop an app that searches the flickr.com and returns me images of my choice. It's jquery and JSOn that I have used. Thanks google!

here is the code


<!DOCTYPE html>
<html>
<head>
<style>img{ height: 100px; width: 100px; margin: 5px 5px 5px 5px; float: left; border: solid black}</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
function fetchJSON() {
var tag = document.getElementById('input');
// document.getElementByID("input");
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
   {
     tags: tag.value,
     tagmode: "any",
     format: "json"
   },function(data) {
   $.each(data.items, function(i,item){
       $('#images').append('<a href="'+item.media.m+'"><img src="'+item.media.m+'"></a>val='+i+'');
       //alert(item.media.m);
       //if ( i == 20 ) return false;
//if ( i == 19 ) fetchJSON();
       });
   });
  }
</script>

</head>
<body>
<input type="text" id='input'>
<input type="submit" value="GO" onclick="javascript:fetchJSON()">


<div id="images"></div>
</body>
</html>


TODO : simple UI tricks.
1. turn off the GO button once it is hit
2. make something like twistori.com with flickr images

Comments

Popular posts from this blog

सूनापन

मुद्दत हो गयी उन तन्हायियो को गुजरे , फिर भी इन आँखों में नमी क्यों है  ? तोड़ दिया मोहब्बत पर से यकीन मेरा, फिर भी मेरी दुनिया में तेरी कमी क्यों है ? हसरत है क्यों आज भी तेरी चाहत की मुझे, क्यों याद तेरी जेहेन से मिटती नहीं ? जलजला क्यों उमड़ता है ख्वाबो में मेरे, उस आशिकी की आगज़नी क्यों है  ? सन्नाटो में भी क्यों सुनता हू तुझे मेरी परछाई से क्यों तू जाती नहीं ? इन डबडबाती आँखों को तलाश तेरी, आज भी कहीं क्यों है   ?

How the Python import system works

How the Python import system works From:  https://tenthousandmeters.com/blog/python-behind-the-scenes-11-how-the-python-import-system-works/ If you ask me to name the most misunderstood aspect of Python, I will answer without a second thought: the Python import system. Just remember how many times you used relative imports and got something like  ImportError: attempted relative import with no known parent package ; or tried to figure out how to structure a project so that all the imports work correctly; or hacked  sys.path  when you couldn't find a better solution. Every Python programmer experienced something like this, and popular StackOverflow questions, such us  Importing files from different folder  (1822 votes),  Relative imports in Python 3  (1064 votes) and  Relative imports for the billionth time  (993 votes), are a good indicator of that. The Python import system doesn't just seem complicated – it is complicated. So even though...

Advice to young web developers

I’ve been making websites in some form or another since 2008. After 12 years of experience I think I’ve accumulated enough knowledge to know a few things. Here’s some things I’d like younger developers to think about, in no particular order: Sometimes a website is just a website. The browser is already a client; HTML is its language. The web is built around server-side rendering. You can provide your data in more than one way; consider HTML to be one of several possible data representations. Scaling your server helps everyone. Expecting client-side scaling only helps people with the fastest computers and Internet connections. Not everyone has (or can use) a mouse. Not everyone has (or can use) a keyboard. Not everyone has (or can use) a touchscreen. Not everyone can see colors or pictures the same way you can. Not everyone can process information the same way you do. It is inhumane to move things around on people. The browser’s native HTML parsing is far faster than anything you can wr...