BURAK UYANIK
Jul 26, 2017 08:06 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
Hi, 1C Sql I am recording data as an image. When I read the sql data, it comes as Type COMSafeArray. How to convert this type to BinaryData?
Yulia Ivanova
Jul 27, 2017 02:05 AM
Active user
Rating:
7
Joined: Nov 3, 2011
Company: 1C Company
Burak, can you please describe your scenario in detail, so we can recommend the optimal solution? What is this image for and what do you mean by "1C sql"?
BURAK UYANIK
Jul 28, 2017 07:06 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
Hi, &Atserver Procedure SAVE_PICTURE() MyPicture = New BinaryData("C:\Users\Burak\Pictures\images.jpg"); AdoCommand = SQLConnection(); AdoCommand.CommandText =" |Ins ert mye_ImageData (TableID,RecID_DBCno,RecID_RECno,ImageID,DataID,Data) |Values (13,0,8,0,'',(SEL ECT CAST('"+ MyPicture +"' AS VARBINARY(MAX))))"; RecordSet = AdoCommand.Execute(); EndProcedure &Atserver Procedure SELECT_PICTURE() AdoCommand = SQLConnection(); AdoCommand.CommandText =" |SELECT CAST((select Data fr om mye_ImageData Where TableID=13 |and RecID_DBCno=0 and RecID_RECno=8 and ImageID = 0) AS VARCHAR(MAX))"; RecordSet = AdoCommand.Execute(); RecordSet.MoveFirst(); While Not RecordSet.EOF() Do Value_ = RecordSet.Fields(0).Val ue; RecordSet.MoveNext(); EndDo; PictureBinaryData = GetBinaryDataFromString(Value_); PictureAddress = PutToTempStorage(PictureBinaryData); EndProcedure
BURAK UYANIK
Jul 28, 2017 07:09 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
Yulia Ivanova
Jul 31, 2017 08:15 AM
Active user
Rating:
7
Joined: Nov 3, 2011
Company: 1C Company
Burak, let's try to localize the error. Please check what you get in this line:
Code PictureBinaryData = GetBinaryDataFromString(Value_);
If you write this picture to a file, does it look like the original picture? If not, what's the difference from the original picture file?
BURAK UYANIK
Aug 09, 2017 03:30 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
Hi, I used "GetBinaryDataFromBase64String" instead of "GetBinaryDataFromString" , it worked . Thank you.
BURAK UYANIK
Aug 09, 2017 03:33 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
How to resize the picture? For example, C# "Bitmap bmp = new Bitmap (pictureBox1.Image, 500, 700);"
Yulia Ivanova
Aug 10, 2017 07:32 AM
Active user
Rating:
7
Joined: Nov 3, 2011
Company: 1C Company
Burak, 1C:Enteprrise does not provide this functionality. However, you can attach an add-in that resizes pictures.
marmara2000 Burak
Aug 11, 2017 02:15 AM
Just came
Rating:
1
Joined: Aug 11, 2017
Company:
Yulia Ivanova
Aug 11, 2017 06:12 AM
Active user
Rating:
7
Joined: Nov 3, 2011
Company: 1C Company
For information about attaching add-ins, see "Chapter 32. Add-ins" of 1C:Enterprise Developer Guide . For information about add-in development, see https://1c-dn.com/library/add_in_creation_technology/ .
Yulia Ivanova
Aug 16, 2017 03:09 AM
Active user
Rating:
7
Joined: Nov 3, 2011
Company: 1C Company
Maybe the PictureSize property of "form field extension for a picture" will help? If you need to resize a picture solely for displaying it in a form, simply set the form field size and then set PictureSize to Stretch. The picture will exactly fit the form field.
BURAK UYANIK
Aug 17, 2017 02:30 AM
Just came
Rating:
1
Joined: Jan 17, 2015
Company: emsteknoloji.com
I made the picture resize with C# and ran RunApp(). Thank you.
Valeriy Martikov
Oct 18, 2021 05:15 PM
Just came
Rating:
0
Joined: Nov 1, 2011
Company:
Вот так надо делать: ИмяФайла = КаталогВременныхФайлов() + ГУИДСтрока + ".png"; SaveOptionsEnum = Новый Структура("adSaveCreateNotExist, adSaveCreateOverWrite", 1, 2); ConnectModeEnum = Новый Структура( "adModeRead, adModeReadWrite, adModeRecursive, adModeShareDenyNone, |adModeShareDenyRead, adModeShareDenyWrite, adModeShareExclusive, |adModeUnknown, adModeWrite", 1, 3, 4194304, 16, 4, 8, 12, 0, 2); StreamTypeEnum = Новый Структура("adTypeBinary, adTypeText", 1, 2); StreamOut = Новый COMОбъект("ADODB.Stream"); StreamOut.Type = StreamTypeEnum.adTypeBinary; StreamOut.Mode = ConnectModeEnum.adModeReadWrite; StreamOut.Open(); StreamOut.Write(ФотоДвоичныеДанные); StreamOut.SaveToFile(ИмяФайла, SaveOptionsEnum.adSaveCreateOverWrite); StreamOut.Close(); ФайлФото = Новый ДвоичныеДанные(ИмяФайла); Base64ДанныеФотографии = Base64Строка(ФайлФото);
Aleksandr Biryukov
Oct 18, 2021 06:27 PM
Administrator
Rating:
19
Joined: Oct 3, 2019
Company:
Hi Valeriy Martikov, our forum was created to help developers from other countries work with the 1C platform. The language of communication on our forum is English. We kindly ask you to duplicate your message in English so that all other participants can understand what you wanted to communicate. I ask you to treat this requirement with understanding.
Subscribe