How do I retrieve image from ImageRegion in Piranha CMS - piranha-cms

I'm making a start page and want to let the user change the image for the carousel. The only way I see now to retrieve the image is by its GUID like this:
Index.cshtml
#UI.Content("1d2b6621-b7f4-4857-b131-0adcdceb4a57")
How would I get it by property name? Something like:
#UI.Content("Model.Regions.CarouselImage1.Url")

Assuming that you region "CarouselImage1" is an ImageRegion you can retrieve the image url with the following:
#UI.Content(Model.Regions.CarouselImage1.Id)

Related

Accessing Image URL on Orchard using razor

I am using Orchard CMS. I am trying to access an image URL on a razor page as per the first image attached.
The output I get through google inspection is also attached as second image. I am simply trying to get rid the square braces so that I access the actual image file
I tried these:
#post.Content.Images.Images.Paths.[0]
#post.Content.Images.Images.Paths.first()
enter image description here
enter image description here
#Orchard.AssetUrl(post.Content.Images.Images.Paths[0])

Access lastMeasurement in HTML widget

I want to reference the last measurment of a device in a HTML widget.
The page https://www.cumulocity.com/guides/users-guide/cockpit/ give samples to access these.
My attempt to show the TemperatureMeasurement doesn't return a result:
{{devices[391].lastMeasurement.c8y_TemperatureMeasurement.T}}
This is currently not possible from the HTML widget. You can only access the data inside the managedObject from there.
Maybe try using the SCADA widget for that and create your custom content as SVG instead of HTML.

How to know the pages where an image is displayed in wordpress

I am not sure if this is possible since I've been googling about this issue but I couldn't find any solution. I am on media of wp-admin, and I am trying to view the pages where a specific image has been used. I am a developer and I don't know how it is done. Anybody help?
Example:
image.jpg
has been displayed in :
www.mydomain.com/
www.mydomain.com/page-1
www.mydomain.com/page-2
I don't know how. Please help.
If you have access to the database, you can make a search for all occurrences of the image link in all posts and pages. To do this you need to get the link of the image through the admin menu. You will have something like:
http://example.com/wp-content/uploads/2016/03/image.png
The post and page content are located in the table wp_posts (Replace "wp_" with your table prefix if not using the default). Now you can do a query like:
SELECT `ID`, `post_title`, `guid` FROM `wp_posts`
WHERE `post_content` LIKE '%http://example.com/wp-content/uploads/2016/03/image.png%'
This will give you the post titles and their links. Should be something like:
ID post_title guid
9 Post Title 1 http://www.example.com/?page_id=9
20 Post Title 2 http://www.example.com/?page_id=20
In Media change the view to List view where you will be able to see which image is attached to which post.
All the images are uploaded under
wp-content/uploads folder
you will inspect using firebug and get the path of the image.
Thanks

How to show uploaded images from server(folder) to index page in asp.net webapi?

Hi all,
I am working in asp.net webapi. I have uploaded my images and I have optimized these images for three different sizes.
Then I clicked on saved in folder in server(App_Data)(folder) in my application, now I need to
Retrive those images from that folder
Show in my index page like i should get that images back
Show original image
Show the different images on radio button selection
Could you please help me retrieve those pictures from my folder (show dynamically),and help me fetch and show images in index page?
Thanks in advance.
As of above i got idea that actually want to do need to retrive images from folder path right
ok for that need to write method in controller its just simple
public static string Getimage( string url)
{
return url;
}
and make call in your controllers like this
Getimage(uploadedfolders)
uploaded folders means patha of folder which images are stored

Hotlinking: How do I differentiate between an image in a <img> tag versus an image link?

I want to allow partial hotlinking to images on my website. I want to allow a specific site (Reddit) to be able to show an image from my website on their page, but if they click on the link to the image from that site, it should go to an image viewing page, rather than directly the image itself.
For example:
This other website should be able to have this
<img src="http://mySite.com/myImage.jpg"/>
on their page, and it should show the image. However, if they have this:
Link Text
A user who clicks on that link should get redirected to an image viewing page that contains some html, including the image, rather than directly to the image.
I'm trying to achieve this via mod_rewrite. However, those two cases have the same HTTP_REFERER. Is there anyway for my server to differentiate between that?
There is no way to do such thing! but if second site is your you can put optional query string at the end of URL the distinguish between them!