A simple web program for image tagging

Source: Internet
Author: User
Tags findone

More than 20000 images need to be marked

The image is stored in MongoDB. The design is as follows,ProgramThe call data is displayed on the webpage,

It is deemed that the labeling results are retained in MongoDB and all the data is marked successfully.

Two parts: the display part and the data processing part in the background.

Display partCodeAs follows:

<PRE name = "code" class = "html"> <SCRIPT type = "text/JavaScript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </SCRIPT> <SCRIPT type = "text/JavaScript "> function output (PARAM) {// alert ($ ('# myimage '). ATTR ('value'); var radiovalue = $ ('input [name = "AAA"]: checked '). val (); // alert (radiovalue); $. ajax ({type: "Get", // method: "Get", datatype: "JSON", data: {"radio": radiovalue, "imageid ": $ ('# myim Age '). ATTR ('value')}, URL: "Save. PHP ", success: function (data) {window. location. reload () ;}}) ;}</SCRIPT> <? PHP $ M = new Mongo (); // select a database $ db = $ M-> fours2; // select a collection (analogous to a relational database's table) $ collection = $ db-> imagelist; $ post = $ collection-> findone (); // element for each image $ imageid = $ post ['_ id']; $ imageurl = $ post ['url']; $ venueid = $ post ['venue _ id']; $ venueurl = $ post ['venue _ url']; $ venuename = $ post ['venue _ name']; $ strimageurl = '<center>  </center> <br> '; $ strimageid =' <center> <Div id = "myimage" value = "'. $ imageid. '"> image_id :'. $ imageid. '</div> </center>'; $ strvenueid = '<center> <div> venue_id :'. $ venueid. '</div> </center>'; $ strvenuename = '<center> <div> venue_name :'. $ venuename. '</div> </center>'; $ strvenueurl = '<center> <a href = "'. $ venueurl. '"> venue_url :'. $ venueurl. '</a> </center>'; // $ imageurl = explode ("", $ I Mageurl); // output result echo $ strimageurl; echo $ strimageid; echo $ strvenueid; echo $ strvenuename; echo $ strvenueurl; echo '<center> <input type = "radio" name = "AAA" value = "1"/> Yes <input type = "radio" name = "AAA" value =" 0 "/> NO <input type =" button "style =" width: 70 "width = 70 value =" Next "onclick =" output (this) "/> </center> '; // iterate through the results // echo var_dump ($ cursor);?>

The program code processed in the background, written in PHP:

 
<? PHP $ M = new Mongo (); // select a database $ db = $ M-> fours2; // select a collection (analogous to a relational database's table) $ collection = $ db-> annotationimage; $ imagelist = $ db-> imagelist; $ value = $ _ Get ['radio']; $ imageid = $ _ Get ['imageid']; $ query = array ("_ id" => $ imageid); $ imageinf = $ imagelist-> findone ($ query ); $ imageinf ['flag'] = $ value; $ collection-> Save ($ imageinf); $ imagelist-> remove ($ query);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.