Hello C++ Guys,
is it possible to make automatic frames for pictures on my web site with C++?
Thank you very much for your help.
Have a nice Christmas,
Josef

Recommended Answers

All 8 Replies

Let me get this straight:

You want a program that will take a picture, and output a new picture with frames?

If so, it should be fairly easy, I think. Just make a bitmap with a little space on each side of the original, and then use the Windows functions to draw on that little space. A normal frame should only take about 3 lines per space, at most.

Hello Mike,
thank you very much for your fast answer.
It is very nice that you thought about my problem.
But, I am not quiet sure if I understand you right.
I allready have pictures but I just want them to have frames around them
when I post them on my web site, and I just thought maybe there is a possibilty to do so with c++?
So, thank you very much, again.
Best wishes for the holidays,
Josef

Well, do you want to change the pictures themselves to have frames, or add frames around the pictures on your web page?

In the first case, you can create a bigger bitmap, and draw a frame around it.

In the second case, I'm afraid you'll have to use some HTML to get the frames around it. If you're using PHP, I'm sure you can write a function that adds a frame around a picture.

But C++ is for applications, so unless you want to write your own Apache that adds frames on your pictures, you'll have to either change the pictures(either with Photoshop or making a program that does it for you), or use HTML with the pictures.

Maybe you could write a C++ program that outputs HTML for frames around a picture?

Hi Mike,
thank you very much for your answer and sorry for my late reply. now i wrote a c++ program that outputs a html. thank you very much for your help.
josef

I assume this must be a school project of some sort where you have to do it this way. If you want a border or a frame look around your pictures, you can put your pictures in an HTML table and change the thickness of the border of the table. Doing it in C++ is more than overkill. You'd have to read the image as binary, calculate coordinates, deal with palettes, then reconstruct the image file. Even if you knew C++ well, it might require a little bit of work if you had a good library. Then you'd have to make it CGI accessible. Good luck.

You'd have to read the image as binary, calculate coordinates, deal with palettes, then reconstruct the image file.

MoveToEx(startoffilex+4,startoffiley+4);
LineTo(endoffilex-4,startoffiley+4);
LineTo(endoffilex-4,endoffiley-4);
LineTo(startoffilex+4,endoffiley-4);
LineTo(startoffilex+4,startoffiley+4);

That's to draw the frame. To get the bigger picture, just make a new bitmap with 8 pixels more width and height, and bitblt into the middle.

I could probably do it in a day, but I'm too lazy to, and he already said he made it output HTML.

Note that I was talking about Windows, not Linux or any other operating system.

And he doesn't have to make it CGI accessible. He can just use it to make the pictures with frames, and use <img> tags to place the framed pictures in.

MoveToEx(startoffilex+4,startoffiley+4);
LineTo(endoffilex-4,startoffiley+4);
LineTo(endoffilex-4,endoffiley-4);
LineTo(startoffilex+4,endoffiley-4);
LineTo(startoffilex+4,startoffiley+4);

That's to draw the frame. To get the bigger picture, just make a new bitmap with 8 pixels more width and height, and bitblt into the middle.

I could probably do it in a day, but I'm too lazy to, and he already said he made it output HTML.

Yes, you could, like I said before, if you use premade libraries. I've had to do this from scratch in Turbo Pascal and let me tell you, it didn't take a day. :cool:

And he doesn't have to make it CGI accessible. He can just use it to make the pictures with frames, and use <img> tags to place the framed pictures in.

How else would he access the C++ program from the page to access the modified images? I don't think he meant to say C++ though, but I could be wrong. It would just be overkill for what he wants to do.

many thanks to all of you!
it is very rare, that people are so selfless and give such a helping hand.
best wishes,
josef

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.