BURAK UYANIK
Jul 26, 2017 08:06 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
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?
Profile
Yulia Ivanova
Jul 27, 2017 02:05 AM
Active user
Points:: 0
Joined:: Nov 3, 2011
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"?
Profile
BURAK UYANIK
Jul 28, 2017 07:06 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
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
Profile
BURAK UYANIK
Jul 28, 2017 07:09 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
Profile
Yulia Ivanova
Jul 31, 2017 08:15 AM
Active user
Points:: 0
Joined:: Nov 3, 2011
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?
Profile
BURAK UYANIK
Aug 09, 2017 03:30 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
Hi, I used "GetBinaryDataFromBase64String" instead of "GetBinaryDataFromString" , it worked . Thank you.
Profile
BURAK UYANIK
Aug 09, 2017 03:33 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
How to resize the picture? For example, C# "Bitmap bmp = new Bitmap (pictureBox1.Image, 500, 700);"
Profile
Yulia Ivanova
Aug 10, 2017 07:32 AM
Active user
Points:: 0
Joined:: Nov 3, 2011
Burak, 1C:Enteprrise does not provide this functionality. However, you can attach an add-in that resizes pictures.
Profile
marmara2000 Burak
Aug 11, 2017 02:15 AM
Just came
Points:: 0
Joined:: Aug 11, 2017
Profile
Yulia Ivanova
Aug 11, 2017 06:12 AM
Active user
Points:: 0
Joined:: Nov 3, 2011
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/ .
Profile
Yulia Ivanova
Aug 16, 2017 03:09 AM
Active user
Points:: 0
Joined:: Nov 3, 2011
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.
Profile
BURAK UYANIK
Aug 17, 2017 02:30 AM
Just came
Points:: 0
Joined:: Jan 17, 2015
I made the picture resize with C# and ran RunApp(). Thank you.
Profile
Valeriy Martikov
Oct 18, 2021 05:15 PM
Just came
Points:: 0
Joined:: Nov 1, 2011
Вот так надо делать: ИмяФайла = КаталогВременныхФайлов() + ГУИДСтрока + ".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Строка(ФайлФото);
Profile
Aleksandr Biryukov
Oct 18, 2021 06:27 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
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.
Profile
Subscribe