powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Caché, Ensemble, DeepSee, MiniM, IRIS, GT.M [игнор отключен] [закрыт для гостей] / Как хранить фото
10 сообщений из 10, страница 1 из 1
Как хранить фото
    #34981778
RustamK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Подскажите. Как хранить в базе фото и как организовать СSP для добавления и отображения фото.
...
Рейтинг: 0 / 0
Как хранить фото
    #34982162
Фотография krvsa
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Хранить можно как в БД, так и надиске...

Пример как использовать в csp есть в документации...
http://cache:1972/csp/samples/showsource.csp?PAGE=/csp/samples/streamserve.csp
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
<html>
<head>
</head>

<body bgcolor=#CCCCFF>

<!-- display standard sample template using a custom tag -->

<script language=Cache runat=Server>
    // This code is just to get the oref of a stream. Normally you would have
    // one as a property of the object you are interested in, however for this
    // example I will create a stream that points to the ClassLogo.jpg file
    // that is in the csp/samples directory, but normally you would do something
    // like 'Set oref=##class(YourClass).%OpenId(id),stream=oref.Stream' to get
    // the oref.
    Set stream=##class(%FileBinaryStream).%New()
    //
    // The stream we wish to link to for this example is in the samples directory
    Set filename=$$GetFilename^%apiCSP("/csp/samples/ClassLogo.jpg")
    Do stream.LinkToFile(filename)
    
    // Now get the id of the stream which is the piece we really want
    Set oid=stream.GetStreamId()
</script>

<p align=center>

<!-- The trick is the use the encrpyted oid of the stream as the parameter to the stream server -->
<IMAGE SRC=%25CSP.StreamServer.cls?STREAMOID=#(..Encrypt(oid))#>

</p>
<br>

</body>
</html>
----------
Cache for Windows NT (Intel) 5.0.20 (Build 6305) Fri Sep 16 2005 11:54:10 EDT
...
Рейтинг: 0 / 0
Как хранить фото
    #35181390
RustamK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
krvsaХранить можно как в БД, так и надиске...

Пример как использовать в csp есть в документации...
http://cache:1972/csp/samples/showsource.csp?PAGE=/csp/samples/streamserve.csp
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
<html>
<head>
</head>

<body bgcolor=#CCCCFF>

<!-- display standard sample template using a custom tag -->

<script language=Cache runat=Server>
    // This code is just to get the oref of a stream. Normally you would have
    // one as a property of the object you are interested in, however for this
    // example I will create a stream that points to the ClassLogo.jpg file
    // that is in the csp/samples directory, but normally you would do something
    // like 'Set oref=##class(YourClass).%OpenId(id),stream=oref.Stream' to get
    // the oref.
    Set stream=##class(%FileBinaryStream).%New()
    //
    // The stream we wish to link to for this example is in the samples directory
    Set filename=$$GetFilename^%apiCSP("/csp/samples/ClassLogo.jpg")
    Do stream.LinkToFile(filename)
    
    // Now get the id of the stream which is the piece we really want
    Set oid=stream.GetStreamId()
</script>

<p align=center>

<!-- The trick is the use the encrpyted oid of the stream as the parameter to the stream server -->
<IMAGE SRC=%25CSP.StreamServer.cls?STREAMOID=#(..Encrypt(oid))#>

</p>
<br>

</body>
</html>
----------
Cache for Windows NT (Intel) 5.0.20 (Build 6305) Fri Sep 16 2005 11:54:10 EDT

это код для отображения фото, а ниже для загрузки


Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
<!-- Copyright (c) 2001 InterSystems Inc. ALL RIGHTS RESERVED. -->
<csp:class description="Demo of how to upload a file from the browser.">
<html>

<head>
</head>

<body bgcolor=#CCCCFF>

<!-- display standard sample template using a custom tag -->
<isc:SAMPLE title="Upload a file Sample">
This sample uses an '<input type=file>' element in a form to upload a file
from the web browser to CSP. Pick a file and hit the submit button to try it.
</isc:SAMPLE>

<!-- HTML Form to submit the file. You must specify the enctype="multipart/form-data" -->
<!-- for this to work -->
<form action="upload.csp" enctype="multipart/form-data" method=post>
    Enter a file to upload here: <input name=FileStream size= 30  type=file>
    <p>
    <ul><input type=submit value="Upload file"></ul>
    <p>
</form>

<!-- As form is submitted to this page look to see if we have the stream in the %request object -->
<csp:IF CONDITION=($data(%request.MimeData("FileStream", 1 )))>
    <hr><br>
    Submitted filename: <b>#(%request.MimeData("FileStream", 1 ).FileName)#</b><br>
    Size of file: <b>#(%request.MimeData("FileStream", 1 ).Size)#</b><br>
    Mime Section: <b>#(%request.MimeData("FileStream", 1 ).MimeSection)#</b><br>
    Type of stream: <b>#(%request.MimeData("FileStream", 1 ).%ClassName( 1 ))#</b><br>
    Content Type: <b>#(%request.MimeData("FileStream", 1 ).ContentType)#</b><br>
    <br>
    First  200  characters of stream:<br>
    <ul>
    <script language=Cache runat=server>
        New bytes
        Set bytes=%request.MimeData("FileStream", 1 ).Read( 200 )
        Set bytes=##class(%CSP.Utils).DecodeData(bytes)
        Write bytes,!
    </script>
    </ul>
</csp:IF>

</body>
</html>

люди подскажите пожалуйста, что мне нужно поменять чтоб хранить и вытаскивать фотки из след класса

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Class Таксономия.Вид Extends Таксономия.Род [ ClassType = persistent, ProcedureBlock ]
{

Property NameVid As %String;

Property NameVidLat As %String;

Property Opis As %String(MAXLEN = "");

Property Foto As %Stream [ Collection = binarystream ];
...
Рейтинг: 0 / 0
Как хранить фото
    #35183687
RustamK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Люди не ужели ни кто не подскажет?
Подскажите, пожалуйста кто знает
...
Рейтинг: 0 / 0
Как хранить фото
    #35183994
Блок А.Н.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
>>Люди не ужели ни кто не подскажет?
Было не раз.
Читать и разбираться в чужом коде лень
...
Рейтинг: 0 / 0
Как хранить фото
    #35184081
RustamK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Может какой пример скиньте как из базы картинку вставить.
Я пробую загружаю файл и пытаюсь чтоб загруженный файл(картинка) отобразилась на страничке ни фига не получается.
...
Рейтинг: 0 / 0
Как хранить фото
    #35184232
Блок А.Н.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Например

http://sql.ru/forum/actualthread.aspx?tid=512637
...
Рейтинг: 0 / 0
Как хранить фото
    #35186469
RustamK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Существуют 2 типа хранения потоковых полей в Cache: FileStream и GlobalStream
1) FileStream - хранятся в файлах (в БД хранится только путь к файлам). Соответственно ограничение - размер свободного места на диске.
2) GlobalStream - хранятся БД. Единственным дополнительное ограничение к размеру свободного места на диске, это максимальный размер БД для вашего типа лицензии.

Других ограничений вроде, размер поля не может быть больше n Мбайт нет.


А как организовать чтобы с клиентской машины взять фото перекинуть на сервер, в базе сохранить путь к ней и потом при обращении получать изображение как сделано в этом приммере.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
<html>
<head>
</head>

<body bgcolor=#CCCCFF>

<!-- display standard sample template using a custom tag -->

<script language=Cache runat=Server>
    // This code is just to get the oref of a stream. Normally you would have
    // one as a property of the object you are interested in, however for this
    // example I will create a stream that points to the ClassLogo.jpg file
    // that is in the csp/samples directory, but normally you would do something
    // like 'Set oref=##class(YourClass).%OpenId(id),stream=oref.Stream' to get
    // the oref.
    Set stream=##class(%FileBinaryStream).%New()
    //
    // The stream we wish to link to for this example is in the samples directory
    Set filename=$$GetFilename^%apiCSP("/csp/samples/ClassLogo.jpg")
    Do stream.LinkToFile(filename)
    
    // Now get the id of the stream which is the piece we really want
    Set oid=stream.GetStreamId()
</script>

<p align=center>

<!-- The trick is the use the encrpyted oid of the stream as the parameter to the stream server -->
<IMAGE SRC=%25CSP.StreamServer.cls?STREAMOID=#(..Encrypt(oid))#>

</p>
<br>

</body>
</html>
...
Рейтинг: 0 / 0
Как хранить фото
    #35186926
Valeriu
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Организуйте простенький глобаль с путями к изображениям
При записи инфо о человеке(например его тб номеру, соответствует названию файла)
сохраняйте в глобаль путь к Вашему файлу

Код: plaintext
1.
2.
3.
4.
^Foto( 7501 )="D:\database\Foto\7501.jpg"
^Foto( 7513 )="D:\database\Foto\7513.jpg"
^Foto( 7515 )="D:\database\Foto\7515.jpg"
......................
^Foto(nnnn)="D:\database\Foto\nnn.jpg"
Потом на клиенте (у меня например настольное приложение на VB)
при простом вызове данных о клиенте с сервера БД поступит и инфо о сохранненом
пути к файлу с фото

Код: plaintext
1.
2.
3.
4.
......
 m.Do "Foto^CAD" , foto
 img1.Picture = LoadPicture("" & foto & "")
 If foto <> "" Then
 cmbFoto.ListIndex =  0 
...
Рейтинг: 0 / 0
Как хранить фото
    #35186952
Блок А.Н.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
используем поиск

Там есть то, что вам нужно.
...
Рейтинг: 0 / 0
10 сообщений из 10, страница 1 из 1
Форумы / Caché, Ensemble, DeepSee, MiniM, IRIS, GT.M [игнор отключен] [закрыт для гостей] / Как хранить фото
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]