Guide

Showing the uploaded image in the preview

Get the add-on here

An upload field can show the customer's image in the product preview: a logo on a cap, a photo on a watch dial, artwork on a poster. You draw the area where the image goes on each view, and the customer moves and resizes it there. The picture in the cart, orders and quote requests shows the image where the customer left it.

On 3D products, the image is shown on the model itself: see On 3D products.

What it needs

  • Form fields 2.2.0 and Product Configurator 2.2.0 or later.
  • On 2D configurators, the canvas viewer. With the image stack viewer, the field works as before, without a preview.
  • On 3D configurators, a model with an object prepared for the image (see Prepare the model).
  • A field that accepts one file.
  • A field shown in the configurator. A quote request layer that asks its fields in the request window has no preview.

JPEG, PNG, WebP and GIF images show in the preview. If the field accepts other file types, those files are still accepted, without a preview.

Where to add the field

The upload field can be in a form layer, or added to a choice of a simple or multiple choice layer.

A common setup is an Artwork layer with a few ready-made designs and an Upload your own choice that has the upload field. When the customer picks that choice, its own image (a frame, or a placeholder) is drawn first, and the uploaded image on top of it.

Set it up

  1. Open the field's settings: the form layer's field, or the choice with the upload field.
  2. Open the Preview section and tick Show the image in the preview.
  3. Under Zones, each view of the product has a row. Click Draw the zone on the views where the image should appear.
  4. In the zone editor, place the zone on the view's image:
    • drag the zone to move it, and its handles to resize it;
    • use the arrow keys to move it by one pixel, with Shift by ten;
    • or type its position, size and rotation.
  5. Click Done, then save the configurator.

The background of the zone editor is the view as customers first see it. A view without a zone doesn't show the image. To remove a zone, open it and click Remove the zone.

Configurator image upload preview options
Configurator image upload - zone placement modal

Masks

A zone is a rectangle. To give the image another shape (a round dial, the curve of a mug), add a mask to the view's row: a PNG with transparency, the same size as the view's images, made like a layer mask. The image only shows where the mask is opaque.

Without a mask on the zone, the image is cut by the layer's own mask, on simple and multiple choice layers. Form layers have no mask of their own.

Options

  • Fit: how the image fills the zone at first.
    • Cover: the image fills the whole zone, and what overflows is cropped. The customer can't make it smaller than the zone.
    • Contain: the whole image shows, leaving space around it if its shape differs from the zone's.
  • The customer cannot move or zoom the image: the image stays as the fit places it.
  • Minimum image width (pixels): optional. When the image has fewer pixels than this across the zone, the customer sees a warning that it may print blurry. Making the image smaller in the zone raises its resolution, so the warning suggests it when it would help.

One placement is shared by all the views: the image is in the same place in each zone.

What the customer sees

When the customer chooses a file, the image appears in the zone and Edit position opens:

  • a frame lies over the zone in the preview. The customer drags the image inside it, pinches to zoom on a phone, or scrolls with a mouse;
  • under the field, Position your image has a size slider with smaller and larger buttons, buttons to move the image or centre it, and Reset;
  • Done, under the field or on the preview next to the zone, closes it.

Edit position under the field opens it again. While it is closed, the preview is left alone: scrolling over it scrolls the page, as usual. Only one field is edited at a time, so zones can overlap.

The controls work with the keyboard and screen readers: the arrow keys move the image, with Shift in larger steps, and Escape closes Edit position.

Cart, orders and quote requests

When the product is added to the cart, or a quote is requested, the picture of the configuration is made with the uploaded image placed where the customer left it, cut by the zone's mask. The file itself is stored with the order or the request, as with any upload field.

When you edit an order or a quote request from the admin, the configurator opens with the customer's image in place, and you can move it.

On 3D products

On a 3D configurator, the image is drawn on an object of the model, like a printed label or a decal. The field's options (fit, the customer cannot move or zoom the image, minimum width) and the customer's controls are the same as in 2D.

Prepare the model

In your 3D software, add an object where the image goes: a thin plate on the cap's front, the face of a phone case, the label area of a bottle. It needs:

  • a name starting with image_location_, for example image_location_front;
  • its own UV map. The image is drawn on the object's texture, so the UV layout decides where it lands;
  • a material. While there is no image, the object shows with its own material, or with a texture another choice gives it. If it has nothing to show without the customer's image (an unlit material whose texture you left out of the file shows black), tick Hide the object while it has no image in the field's settings.

Then export a reference texture: an image of the object's UV layout, at the size you want the texture to be (2048 × 2048 for example). You draw the zone on it.

Keep the image's object for the image only: an object that a text overlay also writes on shows one or the other.

Set it up

  1. Open the upload field's settings and its Preview section, and tick Show the image in the preview.
  2. Under On the model, choose the Object: the list shows the objects of every model in 3D Objects whose name starts with image_location_.
  3. Click Draw the zone, choose the reference texture, and place the zone on it as on a view.
  4. Optionally, add a Mask, the same size as the reference texture: the image only shows where the mask is opaque.
  5. Click Done.
  6. Tick Hide the object while it has no image if the object should only appear with the customer's image. It is then hidden until an image is uploaded, and whenever the choice is not selected. Leave it off when other choices of the layer give the object a texture: one choice shows a fabric, another the customer's image.
  7. Save the configurator.

The camera does not move by itself when the customer places the image. To show the right side of the product, use the choice's Automatic angle switch.

What the customer sees

When the customer chooses a file, the image appears on the object and Edit position opens under the field, with the size, move, centre and reset controls. The image is moved with these controls; dragging on the model still turns it.

If the model is placed several times (on several anchors, with 3D Premium), the image shows on each copy.

Cart, orders and print files

The picture in the cart, orders and quote requests is a picture of the 3D viewer, with the image on the model.

Each order and quote request also gets a print file: the zone with the image as the customer placed it, upright, cut by the zone's mask, at the uploaded image's own resolution. It is listed under Print files in the order line and the quote request, next to the uploaded file, for users who can download the customers' files.

For developers

The pictures with the uploaded image are saved in wp-content/uploads/mkl-pc-upload-previews/. A daily task deletes the ones no cart, order or quote request uses any more, once they are a week old.

  • mkl_pc_form_builder/upload_preview/sweep_min_age: how old a picture must be before it can be deleted, in seconds (default: 7 days).
  • mkl_pc_form_builder/upload_preview/sweep_batch: how many pictures one run checks (default: 200).
  • mkl_pc_form_builder/upload_preview/is_referenced: return true to keep a picture the add-on would delete. It receives the result and the picture's token.
  • mkl_pc_form_builder/upload_preview/max_pixels: images larger than this many pixels are not drawn in the picture (default: 40 million). It receives the limit and the choice.
  • mkl_pc_form_builder/upload_preview/print_max_size: on 3D products, the longest side of a print file, in pixels (default: 4096). A zone larger than this at the image's resolution is scaled down. It receives the size and the choice.

Print files are kept in the same folder, and cleaned up the same way.