Subscibe our Newsletter for FREE and stay up to date with our daily lesson*

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.

  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 :-)

Let's talk it out!

3 Responses to “Introduction to PHP Image Generator”

  • Romeo

    Considerably, the article is in reality the sweetest on this notable topic.


  • gucci handbags

    Good! Thank you!
    Nice tool


  • Samuel

    Kip it up gal! I just found ur blog! Its nice thanks and hv contacted u dnt 4get to reply tanx


What is in your mind ?

Subscribe Me

Learn more the basic tips about WordPress and PHP coding. You can subscribe to our Newsletter to stay in touch with every new stories FREE

Sponsors

WooThemes - Where there's a Woo, there's a way!

Our FaceBook (new)


Discussion Topics

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 need anything, then submit it on Contact Us. If you feel satisfy with my work, please support me to keep it developed

Our Community

Discussion

Petri Lopia

Yep it's about hac*ing but from the white hat point of view :-) So that network and so on admins wou

julian

what is .viva about ?

datafeedr coupon

Useful site and intriguing contribution. I have marked it to come back later. If at first you don't
Close