Thanks for the answers but the problem was with the directories of the web server , not with the script . My dir was outside of the document dir and could not serve content from it .
Comment on Re: Display text and image on same page
Seems doubtful that your webserver is supposed to have a document root of '/', such that an image with a url of '/var/www/grafika/graphHour.png' would work. But, sure, ok.