M
M
Maxim Lesnikov2014-03-26 10:39:36
1C-Bitrix
Maxim Lesnikov, 2014-03-26 10:39:36

How to upload photo in xml?

In general, the task is to upload a photo of an object in xml format.
Condition given:
A set of links to images of a property, each of which is enclosed in an image tag.
If the attribute primary="1" is set for the image, then it is considered the main one.
Link to the image of the property on your site. Type: string.
Format: www.site.ru/image.jpg
Supported image formats: jpg, gif, png....
The code I wrote

//photo
    $db_props = CIBlockElement::GetProperty("18", $arFields["ID"], array("sort" => "asc"), array("CODE"=>"MORE_PHOTO"));
    $razd = "";
    $photo = "";
    while($ar_props = $db_props->Fetch())
    {	
      $rsFile = CFile::GetByID($ar_props["VALUE"]);
      $arFile = $rsFile->Fetch();
            $arImagesPath = CFile::GetPath($ar_props["VALUE"]);
            $domainname = "www***.ru";
      //$photo = $photo.$razd.$arFile["FILE_NAME"];
            $photo = $photo.$razd.$domainname.$arImagesPath;
      //print_r($domainname.$arImagesPath);print_r(" ");
      $razd = ", ";
      //$arrImages[$arElement["ID"]][] = $arFile;
      //print_r($ar_props);
    }
    $fieldsToExport[$i]["images"] = $photo;

Unloading comes from the Bitrix block.
The result so far is:
<photo>
www.***.ru/upload/iblock/f78/cqm yrtlx-2.jpg, www.***.ru/upload/iblock/3c8/01_big.jpg, www.***.ru/upload/iblock/b78/IMG_3286_big.jpg, 
</photo>

Help remake.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Lesnikov, 2014-03-26
@maximka_l

Those. you need to add each photo link in one more tag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question