Customising Product Specification in Rails - ruby-on-rails

I work for a window manufacturing company and would like to add the functionality within the website for customers to be able to customise a product online with a visual representation when adding parts to the order.
So my question really is when parts are selected is it possible to build an SVG image via ajax or maybe Raphael?
The parts would be:
width
height
color
glass type
grid on outside of glass and so on
thanks in advace

I would do it with carefully crafted images. You can easily grow / shrink an image, hide/display an image, and overlay them (keep transparency) all with javascript on the client.
I would not do it with AJAX, instead I'd just load all the images and display, hide or overlay as needed (assuming the number of options are within reason).

Related

How to make TSaveDialog customization dpi aware / scaleable?

Using Delphi 2010 I have customized a TSaveDialog using the resource template approach as shown in TOpenPictureDialog in Delpi's ExtDlgs.
The template approach allows me to successfully insert a form containing several controls in the system save dialog. This works fine as long as the Windows DPI setting is 96. With user defined (text) scaling or hdpi monitors the inserted form is only partly visible. This is of course due to Form.Scaled = True which causes the form plus containing controls to scale (become larger). Currently the template file ( the default as used in for example TOpenPictureDialog ) contains fixed size dialog and static text elements that define the space that will be taken up by the inserted form.
I can think of several workarounds:
No form scaling (not really a solution for hdpi monitors)
Provide different templates based on Screen.PixelsPerInch/96: 100% 125%, 150%
200% etc).
Using the IFileDialogCustomize interface, but that's not really expressive enough for what I want.
The best solution would probably be a way to resize that template (based on Screen.PixelsPerInch/ 96) in memory before it gets loaded by the dialog.
Is something like that available?

Delphi Fortes Report angleLabel on top, across a report

I am making the invoice part of an application, and at this moment I am done with the invoice generation (adding products and stuff).
The next step is to have a report displaying the invoice data, ready to print.
That works too. I used Fortes Reports because it is free, easy to work with, and has a free PDF export filter, and a Preview component, so it has everything I need.
Now, my problem is that I must allow my users to Annull an invoice. So when an invoice was emitted, if there was a problem with it, I cannot just delete it later, I must Annull it (I'm not sure that is how you call it - maybe make it void), but basically the invoice stays the same (in printed form) EXCEPT we must write/draw diagonally on top of the entire invoice one word: ANNULLED with RED color.
That means I will make a new report for this case (annulled invoices) and use this one whenever the user wants to print an annulled invoice
So now in Fortes Report there is an RLAngleLabel component that allows me (in theory) to do just that: draw/write the word ANNULLED on the report. But my problem is that I add the label just fine in the btDetail RLBand, only I just can't see it in Preview, and I have no idea what I am doing wrong. If it's not visible in designtime preview, I assume it wont be visible in runtime neither.
Should I place it in a specific way? Should I add it at runtime somehow? I cant seem to be able to access the report's Canvas so I could draw it in some event...
Does anyone have any experience with what I am describing?
In order to reproduce my problem, just add a RLReport control on your form, add bands to it (Titleband, ColumnHeaderBand, DetailBand), and on a detailBand (DetailGridBand)place an AngleLabel, then right click on the report and choose Preview...
If I place the AngleLabel on the TitleBand or on ColumnHeaderBand, then it shows in preview, except that I need to place this Angled label ON TOP of the contents of the invoice, not on the header info.
In the past I used a BMP image as big as the invoice (in order to have it transparent so I would see the contents beneath it), but that made my exported PDF report 5MB in size, and that is a little too much (PNG was not working correctly - I think it would not display it transparent or something like that, so I was stuck to using BMP).
Is there any way of achieving what I want (described above)?
For whoever encounters this dilema, I reached the conclusion that I should still go with displaying an image containing the desired text as background and setting the bands to Transparent.
The angleLabel approach seems to be unknown, so I dropped it.
I use this time a PNG file that is about 30-40 KB in size and that does not bother me to have it added to the size of the final PDF.
A lot better than the previous BMP image I used before (that increased the size of the PDF file with about 5 MB).
The neweest version of RLReports works with PNG images. That saved me
Also if you have any RLDraw objects on your report, you must set it's brush style to bsClear, so it would allow the background to be visible.

Clojure GUI for cropping images

I'm making a GUI for selecting regions to crop from images. I have been using Seesaw and cans select rectangular regions, but cannot find a way to set an image to the background of seesaw.canvas. This suggests using icons on labels. Can I make a label paintable and then use it as a canvas? Is there a way to overlap a label and a canvas or somehow use a panel that gives a background to its contents?
I think Quil has this functionality, but I'm not sure how to build a GUI around its draw, setup, sketch form if I want add widgets.
Existing solutions would appreciated as well, as long as I can decompose them. Using GIMP or Photoshop isn't an option for the workflow I want: multiple crops per photo, of different kinds on each page and different metadata added depending on the type of image outlined. Any suggestions for libraries for working with metadata for photos? I was planning on using a shell interface to exiftool, but a more portable option may be better.
You can draw a java.awt.Image (or sub-class) to a canvas with seesaw.graphics/image-shape:
(require '[seesaw.graphics :as g])
(defn paint-canvas [c g2d]
(g/draw g2d (g/image-shape my-image 0 0) (g/style)))
It seems like that should do it.
Also note that labels (and all Seesaw widgets) are paintable. Just set the :paint option like on a canvas and paint away.

Photoshop Action to insert text with a box around it

I have a 92 page catalogue (one image per page, multiple products per image) and no product codes on the image for each product.
Does anyone know of a photoshop action to allow entry of a stock code (<15chars text), that will create a filled, outline box with the text inside? It will be awful to have to do them by hand - there are hundreds and hundreds of products.
If all images have the same code, you could record the action which basically creates a macro of your activity for a single image. (Look for the record/playback buttons on the actions pane.)
If all the images have different codes, you might be better off writing (or commissioning) a small script to process the images, such as a PHP script with GD or C# and a graphics object; in both cases reading from a file so it applies the correct code to the image. However this method wouldn't give you an Adobe Photoshop document at the end of the day with an editable text box; it would be a flattened image (such as a TIFF) with the product code already rendered as part of the image.

Is there a ready made RMagick image editor out there?

I am about to build a basic online image editor for my web application using rails and rmagick. I did a bit of googling but couldn't find any existing solution, however I'd like to be sure before I spend a lot of time rolling my own.
Is anyone aware of a plugin/gem that provides a pre-rolled image editor with undo/redo and minimal image degradation on multiple edits?
Thanks!
I know this exists: Rails Image Editor
http://github.com/heurionconsulting/rails_image_editor/tree/master
It might be too late but I'm building one too. I'm using the Pixastic and Raphael libraries to generate live previews. So people can actually preview the resulting image, without having to wait for the server to process it.
Features are:
Quick fit (make the image instantly fitting a given width, height or width and height)
Crop
Resize
Rotate left and right 90º (animated)
Flip horizontal and/or vertical
Colorize (color picker)
Make warmer (slider)
Make colder (slider)
Make greyscale (one click)
Make sepia (one click)
Glow (slider)
Blur (slider)
Sharpen (slider)
Brightness (slider)
Contrast (slider)
Details:
It is provided as a Rails plugin.
Currently it only works on Paperclip attachments.
Integration is piece of cake (js include and a link in the view, that's it!)
It is displayed as a lightbox-like overlay
All requests are Ajax (so no page reloading)
I skipped RMagick and built a dedicated ImageMagick module for serverside image processing
The whole frontend is based on Q, a javascript toolset providing a slider, color picker, floating windows, growl-like feature, I18n for javascript, decent Cookie management and much more.
configurable with a single YAML file
integrated languages are US English and Dutch
Possible downsides:
Live preview on color correction is not available on IE due to lack of HTML5 canvas support
The Q library is not free for commercial domains (only €49 per domain or €249 for a wildcard version)
This plugin will be available for free next month in Alpha release.

Resources