Replies: 7 comments 12 replies
-
Yes, it is possible! In what form are they stored in your database? The goal is to convert them to data URLs and pass the result as an image link. |
Beta Was this translation helpful? Give feedback.
-
Ophir,
I tried it out (adapted a little bit), the sql query works fine within sql
server, but I get a syntax error if I issue the very same sql in sqlpage
(see attached screendump).
Any ideas about what I made wrong?
kr Richard
Am So., 9. Feb. 2025 um 10:05 Uhr schrieb Ophir LOJKINE <
***@***.***>:
… Nice to see deepseek recommending us! What was your prompt, out of
curiosity?
Here is a suggestion to generate the image data URLs from mssql:
-- Create a simple warehouse management tableCREATE TABLE WarehouseItems (
ID INT IDENTITY(1,1) PRIMARY KEY,
Name VARCHAR(100),
Quantity INT,
Thumbnail VARBINARY(MAX) -- Store image data
);
-- Insert sample data with thumbnailsINSERT INTO WarehouseItems (Name, Quantity, Thumbnail)VALUES
('Box A', 50, 0x89504E470D0A1A0A), -- Sample PNG header
('Pallet B', 20, 0xFFD8FFE000104A46), -- Sample JPEG header
('Container C', 5, 0x89504E470D0A1A0A); -- Another PNG
-- Define SQLPage card componentSELECT 'card' AS component, 'Warehouse Inventory' AS title, 2 AS columns;
-- Provide a row for each itemSELECT
Name AS title,
'Quantity: ' + CAST(Quantity AS VARCHAR) AS description,
'data:image/png;base64,' +
(SELECT Thumbnail FOR XML PATH(''), BINARY BASE64, TYPE).value('.', 'VARCHAR(MAX)') AS top_imageFROM WarehouseItems;
—
Reply to this email directly, view it on GitHub
<#803 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYK22YAOOC37EGMTIHGEJDT2O4K7BAVCNFSM6AAAAABWYRNCI2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMJQG42TAMI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
to be exact, I used perplexity.ai and used r1 for reasoning ...
Richard Vogel ***@***.***> schrieb am So., 9. Feb. 2025, 11:22:
… Ophir,
I tried it out (adapted a little bit), the sql query works fine within sql
server, but I get a syntax error if I issue the very same sql in sqlpage
(see attached screendump).
Any ideas about what I made wrong?
kr Richard
Am So., 9. Feb. 2025 um 10:05 Uhr schrieb Ophir LOJKINE <
***@***.***>:
> Nice to see deepseek recommending us! What was your prompt, out of
> curiosity?
>
> Here is a suggestion to generate the image data URLs from mssql:
>
> -- Create a simple warehouse management tableCREATE TABLE WarehouseItems (
> ID INT IDENTITY(1,1) PRIMARY KEY,
> Name VARCHAR(100),
> Quantity INT,
> Thumbnail VARBINARY(MAX) -- Store image data
> );
> -- Insert sample data with thumbnailsINSERT INTO WarehouseItems (Name, Quantity, Thumbnail)VALUES
> ('Box A', 50, 0x89504E470D0A1A0A), -- Sample PNG header
> ('Pallet B', 20, 0xFFD8FFE000104A46), -- Sample JPEG header
> ('Container C', 5, 0x89504E470D0A1A0A); -- Another PNG
> -- Define SQLPage card componentSELECT 'card' AS component, 'Warehouse Inventory' AS title, 2 AS columns;
> -- Provide a row for each itemSELECT
> Name AS title,
> 'Quantity: ' + CAST(Quantity AS VARCHAR) AS description,
> 'data:image/png;base64,' +
> (SELECT Thumbnail FOR XML PATH(''), BINARY BASE64, TYPE).value('.', 'VARCHAR(MAX)') AS top_imageFROM WarehouseItems;
>
> —
> Reply to this email directly, view it on GitHub
> <#803 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AYK22YAOOC37EGMTIHGEJDT2O4K7BAVCNFSM6AAAAABWYRNCI2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMJQG42TAMI>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
Thank you, I made a view with encoded pics, that works ...
Am So., 9. Feb. 2025 um 12:01 Uhr schrieb Ophir LOJKINE <
***@***.***>:
… If you are on azure sql, there is this function
https://learn.microsoft.com/en-us/sql/t-sql/functions/base64-encode-transact-sql?view=azuresqldb-current
—
Reply to this email directly, view it on GitHub
<#803 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYK22YAVLIJFE2MNT54C7AT2O4YQZAVCNFSM6AAAAABWYRNCI2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMJQHAYTANI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
great! can you share your code, and the initial incorrect syntax error so that we can fix it? |
Beta Was this translation helpful? Give feedback.
-
The original code with your suggestion is the window in the middle, left top shows that it works if issued from mssql server directly, to the right you see the error: https://drive.google.com/drive/folders/1VXJytWcc9ukiz_0Y2HBxNrOZKc_Ek-rp?usp=sharing (does not work directly here, need to copy) Finally, I created a view using the below select and this view could be used directly to show pictures from the database on a card: SELECT id, part, descr, I wish I knew how to scale down the pic on the card, because it spreads all over the width of the card, or even better, if tables would also display pics, because there I can easily sort and filter. The thumbnail pics are just a visual aid to quickly identify the correct article. |
Beta Was this translation helpful? Give feedback.
-
I am on a business trip today and have no access to this data. I will come
back to you tomorrow.
Ophir LOJKINE ***@***.***> schrieb am Mo., 10. Feb. 2025,
14:18:
… Could you copy and paste the contents of some of the values in the pic
column here so that we can debug why they are not showing ?
—
Reply to this email directly, view it on GitHub
<#803 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYK22YCIT4IBIKP4BE74CQL2PCRKZAVCNFSM6AAAAABWYRNCI2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMJRHE2DKNY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I am sure it must be possible to display pictures that are stored in a mssql database in sqlpage. Maybe someone may direct me in the right direction or show me a syntax example ...
Beta Was this translation helpful? Give feedback.
All reactions