Class code refuses to run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello;

I have a web page I am developing.

It has images embedded in it.

The src attribute is ./?tag=guitar&type=img

The php code from the html file is:
</php
// preliminary irrelevant code
require_once('php/imageServer.php');

if($_GET['tag'])
  {
   //// file_put_contents('test.txt', "Hello?...img...");
 /*
 the following was working before I expanded it out to running code as written.
it still should work.
(new _IMG_SERV())->serv($_GET);
*/
    $_x = new _IMG_SERV();
    $_x->serv($_GET);
  }
?>

the serv method in the class is

public function serv($_a)
              {
               file_put_contents('test.txt', "Hello?...img...");
               switch($_a['type'])
                 {
                  case 'img':
                  header('Content-Type: image/jpeg');
                  imagedestroy(imagejpeg(imagecreatefromjpeg(self::$_imgDir.self::$_imgIndex[$_a['tag']])));
                  break;
                  case 'txt':
                  if(file_exists(self::$_imgDir.self::$_txtIndex[$_a['tag']]['img']))
                    {
                     header('Content-Type: image/jpeg');
                     imagedestroy(imagejpeg(imagecreatefromjpeg(self::$_txtIndex[$_a['tag']]['img'])));
                    }
                  else
                    {
                     /*
                      create text image, save for future ref and serve
                     */
                    }
                  break;
                 }
              }

This HAS all been working up to a point. BUT the serv function is now refusing to run.
There are no php, javascript or html related errors. 

You will see 'file_put_contents('test.txt', "Hello?...img...");'
Because this is an async request for a resource I cannot use print or echo to sample
code progress. So I have strings written to a text file. The call to file_put_contents('test.txt', "Hello?...img...");
in the top of the serv method is not running. It IS running in the top of the get conditional in the index page
if I uncomment it.

Does anyone know why apache and/or php, and/or possibly the browser would fail to serve a resource
like this when it so far has been working most of the day today? I cannot see anything I have done wrong.
data:
MacOS High Sierra, apache on localhost
Thank you for time and attention;
JK



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux