show image from url

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
tvloeimans
Posts: 22
Joined: 2019-03-20 13:46

show image from url

Post by tvloeimans » 2019-10-07 21:28

Hi all,

I'm building a product system and want to display a image from a url given in the product details. So this is in the database and I want to display this on the page.

How can I do this the best way?

Thanks,
Tim
©2019 - No rights reserved

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: show image from url

Post by pbottcher » 2019-10-08 06:41

Hi,

just to clarify, the url is in the database and that points to an "external" image (an image that does not belong to you app)?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

tvloeimans
Posts: 22
Joined: 2019-03-20 13:46

Re: show image from url

Post by tvloeimans » 2019-10-08 07:29

pböttcher wrote:
2019-10-08 06:41
Hi,

just to clarify, the url is in the database and that points to an "external" image (an image that does not belong to you app)?
Yes, to a external url like supplier website or CDN.
©2019 - No rights reserved

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: show image from url

Post by pbottcher » 2019-10-08 08:53

Hi,

you can add to the TABLENAME.php -> TABLENAME_dv function something like:

Code: Select all

	$url=YOUR_SQL_STATEMENT_TO_RETRIEVE_THE_URL;
	$html.=<<<EOC
	<script>
		\$j(SPACE_TO_PUT_THE_IMAGE_AFTER).after('<img src="$url">');
	</script>
EOC;
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

tvloeimans
Posts: 22
Joined: 2019-03-20 13:46

Re: show image from url

Post by tvloeimans » 2019-10-08 15:42

Ok, will try that later.

Guess there is no build-in option for this unfortunately.
©2019 - No rights reserved

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: show image from url

Post by jsetzer » 2019-10-08 16:23

You should have a look at the new SQL Query feature of 5.80. You should be able to use the SQL concat() function to concat a valid <img>-Tag including the src="" attribute.

Just an idea.
Best,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

tvloeimans
Posts: 22
Joined: 2019-03-20 13:46

Re: show image from url

Post by tvloeimans » 2019-10-08 17:58

just testing with the tip of Jan...

Used this code in the SQL Query field

Code: Select all

SELECT `products`.`item_img_upload` FROM `products` 
CONCAT(`Show`,`products`.`item_img_upload`,`IMG-URL`)
Result in only the SQL data, not the other strings that I added.
Adding html tags kills the query...
©2019 - No rights reserved

tvloeimans
Posts: 22
Joined: 2019-03-20 13:46

Re: show image from url

Post by tvloeimans » 2019-10-15 10:31

also tested with this code:

Code: Select all

SELECT CONCAT(
'<img src="',
`products`.`item_img_upload`,
'">'
) FROM `products`
WHERE `products`.`id`='%ID%'
I only get the value as a return, not the CONCAT string...
Anyone with an idea what goes wrong here?
©2019 - No rights reserved

Post Reply