Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 31, 20222 yr I'm trying to create a visual stream of activity for my website and desktop application, incorporating gallery images, videobox videos, and blog entries into a single stream sorted by date. I have it all working except the blog entry header images. This is important, because the blog header image is what I plan to show in the background of the tiles for blog entries, making the whole system cohesive. I'd prefer not to post any screenshots of my application here, but it looks good and it's a really nice visual way to just take in all recent activity at a glance. Edited July 31, 20222 yr by Interferon
August 1, 20222 yr I have moved this topic to our developer forums, where it is better placed to be assisted with. We would not be able to assist with development under standard support
August 3, 20222 yr Author This code does it, but does not properly parse the CSS attribute, so if any other style elements are added it will fail: <?php function getBlogHeaderImage($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $page = curl_exec($ch); curl_close($ch); // Remove some HTML elements $dom = new DOMDocument(); $dom->loadHTML($page); $classname="cBlogEntry_withPhoto"; $finder = new DomXPath($dom); $items = $finder->query("//*[contains(@class, '$classname')]"); if ($items->length == 0) return ""; $style = $items[0]->getAttribute("style"); $style = str_replace('background-image: url("', '', $style); $style = str_replace('")', '', $style); return $style; } $url = 'https://linustechtips.com/blogs/entry/2114-you-dont-want-to-use-a-linux-converted-chromebook/'; echo(getBlogHeaderImage($url)); ?>