images - How to add a PHP scripts into Wordpress

I have some PHP scripts around 60, which contains images that every 10 secs are refreshing, the source is from a live st

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);
?>

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);
?>
Share Improve this question edited Dec 19, 2019 at 15:32 RiddleMeThis 3,8078 gold badges22 silver badges30 bronze badges asked Dec 19, 2019 at 13:21 Konstantinos MasourasKonstantinos Masouras 11 bronze badge 4
  • 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 Commented Dec 19, 2019 at 13:26
  • @KristiánFilo can you post answers as answers? – Tom J Nowell Commented Dec 19, 2019 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 Commented Dec 19, 2019 at 14:05
  • @ TomJNowell . Damn thanks .. I totally forgot this – Konstantinos Masouras Commented Dec 19, 2019 at 14:52
Add a comment  | 

1 Answer 1

Reset to default 1

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744890016a4599354.html

相关推荐

  • images - How to add a PHP scripts into Wordpress

    I have some PHP scripts around 60, which contains images that every 10 secs are refreshing, the source is from a live st

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信