2

I want to make a button generator with javascript in my site, something like this http://css-tricks.com/examples/ButtonMaker/ .

But I want to add a save button too, so that the user will be able to save the button image he creates. I want to save the image in my server with PHP if possible.

Does anyone have an idea, of what should I really read or search for?

Thanks in advance

1

3 Answers 3

3

The button in the example generator is rendered by your browser. It is just a button element which is styled. I don't think you can easily save it using php.

What you could do is create a button generator that accepts parameters and then renders the image serverside (using php) and sends it to the browser for displaying. This rendered image can then easily be saved.

Sign up to request clarification or add additional context in comments.

6 Comments

Do you have any example of how can I start working on something like this?
I would start with this: php.net/manual/en/book.image.php If you search the web on this you will find examples.
Well GDLib and Imagemagick + jQuery + .load() function with some get parameters generated in the jquery script storing images in db is not good but storing the settings and fetched them with an id is good
what are the parameters I have to send ?
Ok, to correct my previous comment about what to start with: Get a clear mind about what you want to make. to help you get started: You want to make buttons based on some parameters (e.g. color, shape, width length, and so on). You need some user input to get the values for these parameters. These parameters need to be sent to your server, so your script knows what kind of button to create. If you still don't have a clue about what I mean by parameters and how to send these to your server, please start by gaining some basic knowledge before trying to do more advanced excercises like this.
|
0

The link you've provided just defines the CSS for the element - you just eed to send this back to the server - via a form or ajax.

1 Comment

Ok I can send it to the server but then what?
0

One approach would be to send the css settings to your server and execute an html renderer which somehow allows you to save a screenshot of the button.

Googling for "html renderer" yields several results, but I can't tell whether any of them offers an API that allows you to easily save images of desired elements.

(Of course, Firefox and Chrome all count as html renderers too).

In the worst scenario, using my approach, you'd have to render the button server side, take an screenshot and use some algorithm to find and cut the button from the screenshot.

I'd say this is a complicated approach overall. I'd go with what Iljaas' says.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.