Preparing Product Photos for 1C-Bitrix
Raw photos cannot be uploaded to Bitrix as they come from the camera or the supplier. Pre-processing is required: correct dimensions, correct format, correct folder structure. Uploading 6-megabyte RAW conversions directly to /upload/ kills site performance and pollutes the database with records in b_file.
Preparing Product Photos for 1C-Bitrix
Technical File Requirements for Bitrix
Bitrix stores images in the b_file table (metadata) and physically in /upload/. When uploaded via the admin interface or API, Bitrix automatically generates resized versions (/upload/resize_cache/) according to the parameters defined in the components.
Recommended source file parameters for upload:
| Parameter | Value |
|---|---|
| Maximum size on the long side | 2000–2400 pixels |
| Format | JPEG (primary), PNG for products with transparency |
| JPEG quality | 80–85% |
| Color profile | sRGB (not AdobeRGB — browsers cannot display it correctly) |
| Maximum file size | 500 KB for product card, 200 KB for preview |
| DPI | 72–96 (web, not print) |
When rendering via the bitrix:catalog.element component, Bitrix rescales the image to the dimensions specified in the parameters (DETAIL_IMAGE_SIZE). Uploading files larger than 2400px is pointless — Bitrix will create a version at the specified size regardless, but the original will occupy disk space and database records.
File Naming Structure
Before uploading to Bitrix, files must be renamed according to a consistent standard. Bitrix stores the original filename in b_file.ORIGINAL_NAME. File names can later be used to reconstruct relationships and locate specific images.
Recommended naming scheme:
{article}_{sequence_number}.jpg
Examples:
grohe-33265002_1.jpg <- main photo
grohe-33265002_2.jpg <- side view
grohe-33265002_3.jpg <- detail photo
grohe-33265002_4.jpg <- lifestyle / in-context photo
Batch Image Preparation
Automation via ImageMagick:
#!/bin/bash
# Preparing a folder of source images for upload to Bitrix
INPUT_DIR="./raw"
OUTPUT_DIR="./ready"
mkdir -p "$OUTPUT_DIR"
for file in "$INPUT_DIR"/*.{jpg,jpeg,JPG,JPEG,png,PNG}; do
[ -f "$file" ] || continue
filename=$(basename "$file")
name="${filename%.*}"
# Resize, convert to sRGB, JPEG, optimize
convert "$file" \
-auto-orient \
-resize "2000x2000>" \
-colorspace sRGB \
-strip \
-quality 82 \
-interlace Plane \
"$OUTPUT_DIR/${name}.jpg"
echo "Processed: $filename"
done
Flags:
-
-auto-orient— corrects orientation based on EXIF (important for mobile photos) -
-resize "2000x2000>"— downsizes only if larger than 2000px, does not upscale -
-strip— removes EXIF metadata (GPS coordinates, camera data) -
-interlace Plane— progressive JPEG, perceived as loading faster
Bulk Upload to Bitrix via API
After preparing the files — upload to infoblock elements by article number:
// Mapping: article → element ID
$articleToId = [];
$res = \CIBlockElement::GetList(
[], ['IBLOCK_ID' => CATALOG_IBLOCK_ID, 'ACTIVE' => 'Y'],
false, false,
['ID', 'PROPERTY_ARTICLE']
);
while ($el = $res->Fetch()) {
if ($el['PROPERTY_ARTICLE_VALUE']) {
$articleToId[$el['PROPERTY_ARTICLE_VALUE']] = $el['ID'];
}
}
// Load images from folder
$directory = new \DirectoryIterator('/path/to/ready/');
$grouped = []; // Group by article number
foreach ($directory as $file) {
if ($file->isDot() || $file->getExtension() !== 'jpg') continue;
// Parse article number from filename: "grohe-33265002_1.jpg"
preg_match('/^(.+)_(\d+)\.jpg$/', $file->getFilename(), $m);
if (!$m) continue;
[$, $article, $order] = $m;
$grouped[$article][(int)$order] = $file->getPathname();
}
foreach ($grouped as $article => $images) {
$elementId = $articleToId[$article] ?? null;
if (!$elementId) continue;
ksort($images);
$imageFiles = array_values($images);
$el = new \CIBlockElement();
$el->Update($elementId, [
'DETAIL_PICTURE' => \CFile::MakeFileArray($imageFiles[0]),
'PREVIEW_PICTURE' => \CFile::MakeFileArray($imageFiles[0]),
]);
// Gallery — "File" type property
if (count($imageFiles) > 1) {
$gallery = array_map(
fn($path) => ['VALUE' => \CFile::MakeFileArray($path)],
array_slice($imageFiles, 1)
);
\CIBlockElement::SetPropertyValueCode($elementId, 'GALLERY', $gallery);
}
}
Image Formats: WebP
Bitrix does not generate WebP automatically. Two approaches for WebP support:
-
At the nginx level: the
webp_rewritemodule converts JPEG/PNG to WebP on the fly if the browser supports the format. Converted versions are cached. -
Duplicate properties: a separate
GALLERY_WEBPproperty with WebP versions; the component template selects the format via<picture>.
Timelines
| Volume | Timeline |
|---|---|
| Prepare and upload photos for 100 products (1–3 photos per product) | 1–2 business days |
| Prepare and upload photos for 500 products | 1 week |
| Set up an automated processing pipeline for regular stock deliveries | 1–2 days |







