Introduction to PHP Image Generator

Hello everyone, this is my new post after 2 weeks of nothing By the way, i used to have an idea about automatic image or thumbnail generator. What is automatic image generator? Image generator is a generator for image:-)
Here is the demo.

When you call the URL like http://img.hokya.com/car it will generates the image [...]

Hello everyone, this is my new post after 2 weeks of nothing :-) By the way, i used to have an idea about automatic image or thumbnail generator. What is automatic image generator? Image generator is a generator for image:-)

Here is the demo.

  1. When you call the URL like http://img.hokya.com/car it will generates the image of car.
  2. When you call the URL like http://img.hokya.com/cow it will generate the image of the cow.

How can it be? I am not saving the picture on the database and file storage that will be streamed while people trying to load it. I use Google Image databases for doing this. The method is using PHP CURL and simple PHP preg_match to load return address of Google Image Results. Pretty simple isn’t it? The algorithm goes:

  1. Extract the query from URL into variable using simple String commands and .htaccess mod rewrite
  2. Load Google Image Result Page using CURL
  3. Searching for random image src from img tag using preg_match and save it into variable
  4. Load the image from saved src variable using CURL
  5. Print the image content and put attribute Content-type: image/jpeg into it so the browser consider it as image, not as PHP script

Usage

It is a free script and mod for everyone. You can use it on yourown and on anything online. It’s work well and sometimes save your time looking for proper image for posts.

Pass it on your img tag for example:

<img src="http://img.hokya.com/book" />
<img src="http://img.hokya.com/bill-gates" />
<img src="http://img.hokya.com/barrack-obama" />

It’s just too easy to use it. You can pass an address when posting a post on WordPress (for example) .

  1. Open up Add New Post
  2. Insert An Image
  3. Point to From URL
  4. And Type your desired image about, for example http://img.hokya.com/desired

Globally, the usage is pointing to address http://img.hokya.com/your-desired-image-aboutI hope you love it and want to try and give feedback for me :-)

Posted on , ,

Bookmark and Share

Leave a Reply


AJAX Random Post

  • Post Randomizer

    Wordpress' post is ordered by the date of publishing descending by default. It gives a sense of newest topic for the blog that up-to-date at least one post for one day. Sometime, for bloggers who manage blogs individually, of course need some time for just a break. It's okay because blogging is not
  • Google is Giving $100 Free AdWords Coupon

    Do you believe it or not, Google have given free coupons for people all over the world. I can say that because i am one of them who receive a message containing free $100 AdWords Promotional Coupon. It happened on 18 August 2009, i received that email from Google WebMasters messages tab. So in my
  • Don't Mess Up With Your Content !!!

    Hello, in this post i want to notify you not to mess up with your content or your AdSense will be disabled in your site, like i did just 2 days ago :P Why do i make a post about this? Because i don't want people repeat my mistakes. I just want to share the story... Two days ago i got some email f
  • AJAX Comment Page

    If you are running big sites or popular blogs, you must have a lot of comments in your page. It does not matter where are the relevant and the spam, but a page with more than 100 comments in one page must be disturbing your new visitor to read them. As a result, some of your comments will not be rea
  • Why 404 Stated as Not Found ?

    Have you ever wonder about 404 Not Found Message? Why does Not Found pages stated as code 404? If you wonder about that thing so you will find the answer in this post with me :D The code of HTML is selected by the W3C and they selected the code with some reason and meanings. 404 is a code of

References

Who am I ?

My name is Julian Widya Perdana. I study at University of Gadjah Mada, Yogyakarta. I am a young developer addicted in JavaScript, Plugins, Themes, AJAX, and PHP developement. If you feel satisfy with my work, please support me to keep it developed