imagecreatefrompng() doesn't recognize the dynamic path

120 views Asked by At

I want to dynamically open a PNG image, but imagecreatefrompng() behaves oddly. If I provide an explicit path like:

$our_image = imagecreatefrompng("https://example.com/customfiles/avatars/avatar2.png");

it works perfectly, but if I try to submit a string:

$our_image = imagecreatefrompng("https://example.com/customfiles/avatars/".$a);

it does not work. When I output the variable $a I see that it is equal to avatar2.png

Also, gettype() says that $a is a string.

  • What could be the reason of this problem?
  • Can it be something related to different type of strings?
1

There are 1 answers

0
user15933 On

The file name change helped. It seems that the browser took the old file from cash.