dpdhnd3577 2015-07-30 18:43
浏览 37

在Google或文本文件中保存Google图片链接及其关键字

I need to parse Google Images for a specified keyword(s) and retrieve image links, which I can do with PHP simple dom parser, and can retrieve a few image links per call. Google Images API is limited to 100 calls right now. Now, I need to save those image links for a "keyword" so that next time when I need images for that keyword, my script first looks for whether keywords and its related images (i.e. URL's) are already stored in my system and whether there is any need to call Google.

What would the most efficient way to store that keyword and images (i.e. db or simple text files)?

If it is mySQL then what does its schema look like?

Can I store image links in a text file where the file name is keyword?

  • 写回答

2条回答 默认 最新

  • dou12754 2015-07-30 18:52
    关注

    I would suggest using mysql, choosing it gives u flexibility, speed and easy access to your data. Just put info about your images in one table, something like:

    id | name | keyword | path | creTime | size | ext ( and any other that u would need )
    

    Then you can just pull any number of images by Keyword, like "water", "views", or something.

    I would probably make two tables of it, changing keyword for keywordId. Then create foreign key to Keyword_data. Now you have relation One ( keywordId ) from Images_data to Many ( id ) keyword_data.

    id | keyword | description | ( anything else)
    

    That way you can have multiple keywords for any image group, as it would be more flexible.

    评论

报告相同问题?