Hi to all,

I would like to give a feature for users while they are uploading their pictures. Suppose if the user uploaded a picture, then the user has facility to change the uploaded picture into horizontal mirroring and vertical mirroring. Once the user changed the image to his wishes then the image would be saved into server.

Kindly anyone suggest me how to mirroring the image using php in serverside.

Thanku in advance.

HI mahe4us,

Are you using GD or Imagemagick?

With Imagemagick you can use the -flip option to get the mirror image. heres an article on imagemagick for php: http://www.sitepoint.com/article/dynamic-images-imagemagick

If you're using GD, unfortunately there is no function to get the mirror image using GD functions in PHP.
The only way I can think of is to:

1) Get each color of the image pixels (using: imagecolorat() function. http://www.php.net/manual/en/function.imagecolorat.php)
2) Place all the colors of the pixels in a corresponding Array.
3) Manipulate the Array using the Array functions. http://www.php.net/array. (eg: To get the mirror image along the right side of the image, then reverse all array values from left to right.)
4) Create the mirror image from the manipulated array of colors by drawing each pixel. (http://www.php.net/manual/en/function.imagesetpixel.php)

It would probably won't be the most efficient solution..

Hi Digital-Ether,

Glad to meet you once again with my query. I gothrough the sites given by you . It is very effective. Apart from that, somebody told me to mirroring,cropping,rotating the images via OCR programs. That means OCR programs are written in VC++ . Inputs are given through php and the processing are held in vc++ in the server and the return result are get output at php pages.

image rendering
images
PHP -------->VC++(OCR PROGRAMS)---------> output at brower(PHP)

This is the concept i want to tell you. Have you any idea about this.....
Is this possible ????

I expecting your reply........

Its seems that OCR (Optical Character Recognition) programs are designed specifically for recognizing text/characters in Image files, not transforming images.

I would think that the GD lib (written in C++ also) or Imagemagick would be more suited for manipulating images than an OCR program since its designed specifically for manipulating images. They are easier to use since PHP extensions have been developed for both.

If the OCR program has the mirror image function however, it may be the better one to use. who knows..

If you go with using an OCR then, you'd have to install the OCR program on your server however.
I think you can then access it via PHP by executing commands through the system() or exec() function or one of the like.

Hi Digital-Ether,

Thankyou for your kind reply. I have realised that imagemagick is better than OCR programs and it is easy to manipulate images in a better way. I have some doubts regarding imagemagick php extensions. I have succesfully installed imagemagick in my windows system. Now iam trying to install magickwand for php. But it has some difficulty to install.

Please gothrough the below URL...
http://www.imagemagick.org/discourse-server/viewtopic.php?t=4708&highlight=install

In the above URL they explained how to install imagemagick and magickwand for php. I have understood imagemagick installation but magickwand is somewhat difficult. If you have get any ideas....kindly suggest me how to install magickwand dll files in server after imagemagick sucessfully installed.

Expecting your great reply...

Hi we are trying to develope the same thing for AXJ and why reinvent the wheel. We will pay for the code. Thanks. AXJ

This article has been dead for over six months. Start a new discussion instead.