Extract image link from TinyMCE in Laravel - laravel

I'm making an image sitemap for my site I'm trying to extract the image link from the post and I'm using the TinyMCE text editor Need Help pls.
I use this code but the problem is I do this in the controller and I can't do it in the view This code being in the Controller leads to two problems, first, that I will not be able to all the images for one post, but I have to fetch the images of all posts together at once. The second thing or the second problem is that this code extracts the images twice: the link I want and the link inside So I want a solution so that I can extract images for one post
Below is a picture of the code in the controller

Related

Trouble grabbing newest image on web page using IMPORTXML Xpath function

I'm tasked with making some of the images on a website appear in Google Sheets via the -IMPORTXML function. I have a basic knowledge of Xpath, but here I am just trying to show the current image (because it changes often) instead of pulling in the image URL.
On this link: https://www.kissusa.com/nails/best-sellers
I'm using this, returns "N/A": =importxml(A2,"//*[#id='layer-product-list']/div[2]/ol/li1","src")
To get this image in the first row of products: enter image description here
Any suggestions on how this can happen are greatly appreciated.

Google Sheet & App Script : how to get image from a link preview?

I am trying to reproduce a RSS reader like Feedly with Google Sheet and displaying with Glide as an app on my mobile phone.
Everything's fine with IMPORTFEED() function with titles, description, URL.
But it seems this function doesn't allow pictures to be displayed even if they are in the feed (which is not all the time).
So I am looking for a way to extract the main image from a blog post... the one displayed when you hover on a link in a Google Sheet cell.
I would like to get the link of that image displayed in the link preview and put that link in another cell.
Here is an example:
I tried IMAGE()
and also IMPORTXML when there is an image in the RSS feeds (but not all of them do... so I stopped)
Is it possible in Google Sheet to get the main image from the one displayed in the link preview ?
For instance, one of the blog I want to extract the main picture of a blog article would be Creajv (URL : https://creajv.com/ ; Feed : https://creajv.com/feed/)
So the IMPORTFEED() function I did in Google Sheets was :
=IMPORTFEED("https://creajv.com/feed/";"items";FALSE;3)
Which stands for :
=IMPORFEED(...) the function to import feeds from an URL
"items" the way to pull every data there is in the feed (you can use other parameters and can see all the possibilities on the GoogleFormulas documentation)
FALSE because I don't want the headers to be included
and the number 3 because I want only the last 3 results displayed.
And it displays perfectly : author, description, URL, date
But I did a little digging in Google and found that basically IMPORTFEED() cannot get images from feeds, even if it is added by the author of the blog (he has to add a feature to do it).
So I am now trying to see if there is another way which is not IMPORTFEED() to get every time the main image of a blog post.
And I saw Google Sheet is able to pull instantly it when I copy paste the URL of a blog article within a cell for instance for Creajv :
Print screen of the image I get when I click in the cell which contains the post URL
So my thoughts would be that I can pull the author, date, description etc. with IMPORTFEED (which works perfectly every time) and use a formula on the cell with the URL to get in another cell the URL of the picture pulled from the one in the link preview.
Two other possibilities might also be with Google App Script :
creating with the App Script a custom function
or creating a script pulling the image in a cell every time a new row is added via the IMPORTFEED() function.
Functions only, as Apps Script doesn't run on mobile Apps
How about this solution? I checked the website and inspected the image from the thumbnail.
Luckily, the structure is simple:
<div class="article-image">
<img src="https://creajv.com/wp-content/uploads/2020/11/HighresScreenshot00000.png" alt="Concours de Level Design avec Unreal Engine, du 11/11 au 05/12/2020">
</div>
You can get the url with IMPORTXML, and apply IMAGE to it:
=IMAGE(ImportXml("https://creajv.com/2020/11/08/concours-de-level-design-avec-unreal-engine/", "//div[#class='article-image']//img/#src"))
Since you are already retrieving the post url with your previous formula, change the source url by the correspondent cell:
=IMAGE(ImportXml(C1, "//div[#class='article-image']//img/#src"))
For example:

MVC4 render image with Ajax call

Masters,
I have a scenario where i have a list of Items and on clicking single item it gets details along with image src url using ajax call.
I want to display(render) image right on page.
Now Image source URL is a FileActionResult returning Base64 string.
The problem is the page does not render image although it is having correct Src URL.
And I don't want any additional Ajax call.
Please Help.
Thanks in advance.
How are you forcing the image to be updated?
The DOM is going to keep the image the same until you tell it to refresh the image -- I would suggest using something like
document.getElementById('theImg').src="/newImg.gif?unique=someuniquestring";
where someuniquestring is a new random datetime or something (to make sure browsers like IE don't cache the GET request).

Displaying image and pass dynamic data to pyrocms page

i need to display an image on a page which i developed from content/pages. But i dont know how i can display image and pass dynamic data to this page.
Well! after waiting for people to answer i did some research and found that this work is done through tags and involves the use of partials.

any tutorials/blogs regarding uploading more than one db images

I have exhausting goggle looking for a way to upload more than one db images.
I had a look at
http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files or http://mattias-jakobsson.net/post/2009/11/19/Handling-image-uploads-with-AspNet-Mvc.aspx or http://www.johnpscott.co.uk/devnotes/picpick/default.aspx or http://rusanu.com/2010/12/28/download-and-upload-images-from-sql-server-with-asp-net-mvc/ and so on. I no luck.
Does anyone has a tutorial or recommend a book that demostrate how to upload more than one db images. I am using vs 2010, asp.net mvc3 in C# with SQL Server 2008R2. All I am trying to do is to have couple db images for each product.
Thanks
The first link you provided is a good start for what you need.
Store all images for a product change....
It shows how to upload multiple files. From this you could modify the table where the images are inserted to add a key for the record relation back to your product.
Retrieve all images for a product change...
To pull them back from the database you would call the code in the same article (GetFile), modifying the select statement to include your product key INSTEAD of the ID of the individual image.
Display all images for a product change...
This is where it changes quite a bit. The author of the first article still returns one file as a FileContentResult. Obviously, this won't work for your situation.
Have a look at this article. It uses an XML file to load up multiple images BUT you would replace this code with the code in GetFiles to create the Image List. It shows how to create a controller, model and view for this. You could create a partial view to have the images on the same page as the product view.
This sample shows how to get an image list out of the DB into a view. (To help with modifying GetFiles to better work for this...)

Resources