Tutorials/understand newbasepicture implementation

= How does the base picture functionality work? =

Since the shopversion 4.3.0 a new picture handling has been implemented. Some people now ask "How can i import my pictures manually" or "Is it necessary to upload them via admin, i like to use different picture sizes" and so on. This short tutorial should give an overview how to use and how to kid the new functionality.

First: How does it work?
The new base picture functionality is very simple you wont believe it ;-)

If you upload a picture via admin the shop first copies the file to /pictures/master/ and inserts the name of the file into the database, for example we uploaded Picture 1 test.jpg so we will have this information in our database:

OXPICSGENERATED = 0 OXPIC1    = test.jpg

And the original file is at /pictures/master/1/, now if i go to the shop frontend and take a look the first time at the product or at a list/category which contains the product, the shop checks the value of OXPICSGENERATED.

If there is OXPICSGENERATED = 0 it will generate the following files, according to the pictures size defined at Master Settings =&gt; Core Settings =&gt; Settings =&gt; Pictures :

/out/pictures/0/test_th.jpg /out/pictures/1/test_p1.jpg /out/pictures/z1/test_z1.jpg /out/pictures/icon/test_ico.jpg

Now we will have OXPICSGENERATED = 1, if you added OXPIC2 also you will get OXPICSGENERATED = 2 and so on. From now on the shop always uses the generated files from /out/pictures/* directory. So no measurable performance lost appears.

If you you uploaded icon and thumb separate, the database fields OXTHUMB and OXICON contains the name of the pictures and no icon or thumb will be generated if you upload OXPIC1.

Second: How can i use my own pictures without admin interface?
Sometimes it is necessary to upload the pictures manually because of size, amount or other reasons. Its quite simple if you know how ;-) There are two options, with and without automatic picture generation.

First we will have a look at the regular way, with picture generation
Since 4.3.0 we have this structure in db:

***notneededfieldsbefore*** OXPICSGENERATED OXPIC1 OXPIC2 OXPIC3 OXPIC4 OXPIC5 OXPIC6 OXPIC7 OXPIC8 OXPIC9 OXPIC10 OXPIC11 OXPIC12 ***notneededfieldsafter***

If you updated you database you also have some hangover fields from older version. Here it is only necessary to set the values of OXPIC1 to OXPIC12. These fields only contain the name of the master picture! OXPICSGENERATED must be set to 0. Now you can start with the FTP upload of all master images to /out /pictures/master/[NUMBER OF OXPIC] Thats it! All needed pictures will be generated with the first visit of product details.

Now we will have a look at the picture upload without generate
First we fill the database fields with the needed info, same like above OXPIC1 to OXPIC12 contains the name of the master image. And now the special gimmick OXPICSGENERATED = 12 After the database update you can start with the picture upload, first upload the master picture to /out/pictures/master/[NUMBER OF OXPIC], its necessary because shop checks if it exists (it can be a dummy file or an copy of the zoom image ). Now upload your self generated images to the regular directories and use the same name syntax like in the first example:

/out/pictures/1/test_p1.jpg /out/pictures/2/test2_p2.jpg /out/pictures/z1/test_z1.jpg /out/pictures/z2/test2_z2.jpg ...

If you also like to upload your thump and icon manually just import the file name to OXTHUMB and OXICON and upload the pictures to /out/pictures/0/ or /out/pictures/icon/. Thats all now your self generated pictures will be used for front-end.

= Making pictures editable in subshops (Enterprise Edition) =

By default, the picture info is saved in the oxarticle table and is shared between the shops. To make pictures different in the sub-shop, enter the names of overwritten oxarticle columns in config.inc.php $this-&gt;aMultishopArticleFields array and add the required fields in the oxfield2shop table.

Important: if any of the oxpicX columns are overwritten, it is required to add OXPICSGENERATED column too, as it is used in the calculations.