lml / sketchily

Embed SVG-edit in Rails HTML forms
MIT License
26 stars 9 forks source link

Change background image #6

Closed ghost closed 11 years ago

ghost commented 11 years ago

After couple of hours (well, almost two days) I still wasn't able to monkey-patch this awesome gem somehow to be able to set the background image, so that user would be able to draw over it. Since I did not find any other place where to turn for help, I dared to write here. Could you please point me to some directions, how it would be able to set the background image in program?

Dantemss commented 11 years ago

Just a feature I never thought about. Svg-edit does have a background image option, so I'll just add this in and see if it works properly with what the gem does.

ghost commented 11 years ago

That would be really appreciated. Thanks in advance.

jpslav commented 11 years ago

Would be useful for us as well.

On Mar 4, 2013, at 11:37 AM, nor23 notifications@github.com wrote:

That would be really appreciated. Thanks in advance.

— Reply to this email directly or view it on GitHub.

Dantemss commented 11 years ago

OK I added 3 relevant options for you guys in 1.3.0:

bkgd_color -> canvas background color, e.g. FFFFFF (not saved with image)

bkgd_url -> canvas background image url (this is not editable by the user and not saved; essentially the user just draws on top of it, but it will not be displayed by sketchily_show)

url -> image that is loaded when the editor starts, essentially overwriting anything the user has done so far (so make sure to set this only the first time if you use it). The user can edit the image and it is saved together with whatever the user drew (so will be displayed by sketchily_show).

Let me know if an option to add a background image to sketchily_show would be useful (for use with bkgd_url if you want the background to be displayed).

Also let me know if you find any more issues.

Dantemss commented 11 years ago

I added bkgd_color and bkgd_file options to sketchily_show in 1.4.0 to help you display any backgrounds you use on the editor if you so wish. They are the same as the editor options except bkgd_file uses a local file on the server instead of an url. As far as I tested, the background image seems to align very well on the editor and when displaying. Feel free to open a new issue if you find any problems.