This reference - http://www.errorlevelanalysis.com - seems to imply that you recompress a JPG image at some other compression amount (namely, 95%) and then do a pixel-by-pixel difference. You can do that in ImageMagick (or PHP Imagick).
For example in ImageMagick 6:
Input:
convert barn.jpg \( +clone -quality 95 \) -compose difference -composite -auto-level -gamma 1.5 barn_ela.png
I have stretched the result to full dynamic range using -auto-level and then did a non-linear gamma adjustment to enhance the differences.
See also https://sites.google.com/site/elsamuko/forensics/ela, where they provide two separate images and are looking for where they differ most as change detection.