0

I have some PHP scripts around 60, which contains images that every 10 secs are refreshing, the source is from a live streaming server.
My question is how to add them to WP? Some the code is on the image

The result, in the end, should be an image that is refreshing every 10 secs. Any ideas? Should I create a shortcode? and insert the code inside? Any plugin?

<?php
    ini_set("default_socket_timeout", 10);
    // Report all PHP errors (see changelog)
    error_reporting(0);
    date_default_timezone_set("Europe/Athens");


    copy("http:/streaming/channels/1/picture", "temp.jpg"); 

    header('Content-Type: image/jpeg');
    $cam_me          = @imagecreatefromjpeg('temp.jpg');

    //йахояислос вяылатым
    $white = imagecolorallocate($cam_me, 255, 255, 255);
    $grey = imagecolorallocate($cam_me, 128, 128, 128);
    $blue = imagecolorallocate($cam_me, 0, 0, 200);
    $black = imagecolorallocate($cam_me, 0, 0, 0);
    $offblack = imagecolorallocate($cam_me, 30, 30, 30);

    //LOGO
    $cam_logo        = @imagecreatefrompng('logo.png');
    $cam_logo2  = @imagecreatefromjpeg('logo2.jpg');


    //Create blue frame
    imagefilledrectangle($cam_me, 0, 0, 2688, 30, $blue);

    //
    //Font
    $font = 'tahoma.ttf';

    //елжамисг омолатос йалеяас
    imagettftext($cam_me, 25, 0, 800, 30, $white, $font, "Σαμαρίνα Πλατεία" );
    imagettftext($cam_me, 30, 0, 2460, 1265, $white, $font, "" );
    imagettftext($cam_me, 30, 0, 0, 1350, $white, $font, "" );
    imagettftext($cam_me, 40, 0, 2100, 1390, $white, $font, "" );

    //Import  LOGO
    imagecopy($cam_me, $cam_logo, 1600, 80, 0, 0, 300,129);
    imagecopy($cam_me, $cam_logo2, 2500, 1338, 0, 0, 161, 160);


    imagejpeg($cam_me);
    imagejpeg($cam_me, 'samarinaplateia.jpg');
    imagedestroy($cam_me);
    imagedestroy($cam_logo);
    imagedestroy($cam_logo2);
?>
  • 1
    You could use AJAX to run a simple PHP script in an interval, that returns requested image URL. Once you retrieve this URL in AJAX response, you can change the image source using jQuery. – Kristián Filo Dec 19 '19 at 13:26
  • @KristiánFilo can you post answers as answers? – Tom J Nowell Dec 19 '19 at 14:05
  • Your username and password are in the screenshot in your copy command, you should change them as they'll be in the edit history even if you remove the image – Tom J Nowell Dec 19 '19 at 14:05
  • @ TomJNowell . Damn thanks .. I totally forgot this – Konstantinos Masouras Dec 19 '19 at 14:52
0

You could basically create a simple plugin, that will generate a shortcode. The function of this shortcode would be displaying the required images. You can choose between Ajax or maybe using the embedded PHP timer to trigger Ajax to retrieve the images. Then you embed this shortcode in your post or page (wherever you wish your images to be displayed).

Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.