ofImage not working

It seems to work with string itself as argument but not with modified string object as argument.

I really don’t know why.

ofImage a = ofImage("streetViewMap_37.734612_-122.508373.jpg");
cout << "this works!!!!!!" << endl;

ofBuffer file = ofBufferFromFile("cityData");
while (!file.isLastLine()) {
    vector <string> values = ofSplitString(file.getNextLine(), ",");
    string imagePath = "streetViewMap_"
    + values[0]
    + "_"
    + values[1]
    +".jpg";
    cout << (imagePath) << endl; // it actually generate correct image file name.
    imageData[id] = ofImage(imagePath); // id will increase, I just took out the script for this part. this part says error msg below.

}

[ error ] ofImage: loadImage(): couldn’t load image from “streetViewMap_37.741412_-122.507873.jpg”

Thank you!

One potential issue I see is that your file names contain periods (" . "). This could be a reason why OF is confused when reading the images because it is reading a wrong file-extension - although then I don’t understand why it does work when passing the filename directly as an argument.

I think what is incorrect here is you need to declare ofImage a in ofApp.h then in the ofApp.cpp under the setup() function say a.loadImage(“street.jpg”) Also, like @inoodle mentioned, I would make it a more simple name if possible. The multiple use of “.” might be causing it not to load.

@inoodle @michaelpromeo

Yes, it was that ‘.’.
OF was confused about it.
I renamed all the image without “.” when I combine.