0

I was just talking to a friend last night about one of their projects and they said they had manually created an image map for a trade show using Adobe Fireworks. I was thinking of some of the code golf things I had seen in the past like this one asking how cloudy the day is: https://codegolf.stackexchange.com/questions/136405/how-cloudy-is-it

Made me think that this should be able to be done automatically. Any tips on how to use PHP / Javascript to either auto create an image map, or get size / coordinates of each square where you could overlay divs over them with absolute positioning so you could click on it.

enter image description here

Alan
  • 2,046
  • 2
  • 20
  • 43

1 Answers1

0

JS: I was not aware of this but apparent jQuery can read image dimensions.

PHP: ImageMagik can read an image and provided image dimensions (as well as much more info about the image. To interface with is using PHP a number of libraries exist to do exactly that.

David J Eddy
  • 1,999
  • 1
  • 19
  • 37
  • Thanks David, I have worked with ImageMagik and jQuery to do this in other projects, but what I was wondering is how to get the size and position of the Sony booth in the bottom left as an example. – Alan Sep 29 '17 at 16:43
  • @Alan , Ahm ok, For that you'll be wanting to leverage OCR (optical character recognition) and then some sort of color / pattern recognition system. Have the OCR find `Sony`, then find the encapsulating color pattern (or search for the color black. then cycle and find the co-ordinates of the corners. For OCR this looks promising https://github.com/thiagoalessio/tesseract-ocr-for-php for the pattern / color segment. I am at a lose for that at the moment. – David J Eddy Sep 30 '17 at 20:00
  • 1
    Found one for shapes: https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/ – Alan Oct 02 '17 at 13:38
  • Ah, OpenCV (computer vision); a very interesting part of computing. Thought written in python (OP title states PHP/JS). Best of luck, let us know how it turns out! – David J Eddy Oct 02 '17 at 14:20