Google Apps Script to refresh stock chart image from URL - image

How can I set up a Google Apps Script (or other method) to refresh a stock chart image using the image URL each time the sheet is viewed or on a periodic basis?
For example I have the following image in my Google Sheets file:
http://etf.bannronn.com/stocks/genchart.php?symbol=VOO
...but it is not updating when I load the sheet on following days even though I added the image using the URL(I've compared the charts to be sure).
Any tips on how to do this?

You can append a unique value to the URL so that each time the sheet opens the URL changes though technically it is still the same.
For instance, you can say:
= image("http://etf.bannronn.com/stocks/genchart.php?symbol=VOO" + "#" + rand());

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:

How to process image width/height in TYPO3?

I built a website in plain html/css with my own design. Now I need to put this website in TYPO3 CMS 9.5.4. Unfortunately it's my first time working with TYPO3 and I don't really know what I'm doing.
What I got so far:
Most of the website is already working fine. I included fluid_styled_content and my setup basically looks like this:
page = PAGE
page.1 = FLUIDTEMPLATE
page.1 {
file = fileadmin/sitedesign/Resources/Private/Templates/Page.html
variables {
content < styles.content.get
}
}
The Page.html file is basically my whole html template and I put
{content->f:format.raw()}
where I want my content.
All content I create in the backend is displayed as I want except of images.
My question:
I can display images by creating a "Text & Images" content element and adding the images in the "Images" tab. In the "Media Adjustments" section I can now set the width and height of each element and below I can choose the number of columns.
However these do not change anything in the source code of my website i.e. in the content variable, so all images are displayed in full size.
What can I do to make the width/height appear in the source code (ideally as width/height attribute of that element)?
Hey Erik and welcome to TYPO3. Usually TYPO3 will take care of the correct images sizes when using the default Content Elements (e.g. Text & Images). But TYPO3 requires ImageMagick or GraphicsMagick installed on the server to modify the pictures.
You can check out if your system matches all requirements using the "Environment" module in the TYPO3 backend (modules on the left side of the backend). Then you will see a function called "Image processing" which will test the required image functions of your server.

what is the difference between response.write(image url) and response.binarywrite(image data)?

I am working on a VBscript asp page that is supposed to render a user's photo graph from our database, based on an ID value that is passed to the page via the URL string, to be used in various email functions. This part works great, using the following code to render it:
Response.ContentType = "image/jpg"
Response.BinaryWrite(rsAttPic("ind_photo_ext"))
I was asked to provide a default image, because if the user does not have an image on file in the DB, they get a broken image icon. After some trial and error, I finally got something to work:
if (IsNull(rsAttPic("ind_photo_ext"))) then
Response.Write("<img src='placeholderm.png'/>")
else
Response.ContentType = "image/jpg"
Response.BinaryWrite(rsAttPic("ind_photo_ext"))
end if
This works when testing it through the presentation page on the website (showpic.asp) - both images display as expected, depending on the record being referenced in the URL. However, when that page, showpic.asp, is referenced by other sources (emails sent via campaign software, confirmation emails generated by our CRM software), only the user image shows up as expected. The generic image does not show in the emails, only a broken image link.
What is the difference between the two types of image presentation? I did notice in testing that the user image appears in the browser in the center, black bground all the way around it, while the default image appears in the top left corner of the browser window, white bground. Is that related?

selecting a page content in apple script

I want to go through a MS Word document page by page and generate images of all pages. I am stuck in the very beginning. Although I can compute total number of pages I cannot get the content of say page 1 into selection object.
I want something like
select page 1 of active document
or
set myRange to create range active document page 1
or
create range active document start (start of page 1) end (end of page 1)
Of course I have the page count and I want to loop on it and generate images page by page but please help me first to get page content into a selection object so that I can proceed.
If anybody has some other idea of accomplishing the job them I am all for it.
I have solved it.
The steps are.
Convert word document to pdf through apple script.
Make a work flow in automater to render pdf as images.
Call the word flow through shell command from apple script.
I will make a tutorial in few days and post some where.

Resources