C++ Equivalent JPEG Functions?

This is a discussion on C++ Equivalent JPEG Functions? within the C++ Programming forums, part of the General Programming Boards category; I was wondering if there were jpeg functions in C++ that are equivalent to the following PHP jpeg functions:
imagesx ...

If there isnt equivalent functions, how would I check to see if a file is a VALID jpeg file (not just with a .jpg extension), retrieve the width and height, and "change" the quality of the image. In PHP, I use imagejpeg(image); to decrease the filesize of the image, but it doesnt necessarily "change" the quality.

I have downloaded and installed the JPGalleg for Allegro library. I was able to call the function load_jpg, but the program comes up with the this program is not responding thing and the program quits. When I change the load_jpg function to load_bitmap and use a .bmp image, it works just fine and dandy. I'm having troubles getting it to a load a .jpg image. Any help is greatly appreciated.

Any help is greatly appreciated. All I need to do is retrieve the width and height of the image and to be able to "change" the quality of the image (kinda like opening and image in MS Paint and hitting save, the filesize goes down unless you have already saved it with MS Paint).

Libraries being linked when compiling in order: -lalleg -ljpgal -lallp

For some reason, if I dont link the library -lallp, then it wont work. None of the examples and none of the documentation says to link this library. This could be the problem.

The above example compiles; however, when I run the .exe and it comes to the load_jpg() function of the code, it returns the "test.exe has encountered a problem and needs to close. We are sorry for the inconvenience." error.

All ya'll had to say was to switch the order in which the libraries are ordered. You have to put -ljpgal first, then -lalleg. Then you dont have to include -lallp. The above example works now, thanks to myself for actually reading the documentation FAQ portion. If I have any other JPEG related questions, I will start a new topic since no one decided to post in this one.

Code I wrote using the JPEG library manual (info found on MSDN I believe). I also strongly believe something similar is on nehe.gamedev.net (OpenGL graphics tutorials). This loads the pertinent data utilizing the jpeg library (jpeg.h + jpeg.lib in my project) and returns a texture.