Hi Friends,

User logged in as: ankit.baphna@gmail.com

  I am creating gif image by below line 1 code with name demo25_"email address of user" 
  ex: demo25_'ankit.baphna@gmail.com'.gif

  it gets created in my folder with naming within single qoutes:  'ankit.baphna@gmail.com'.gif

but I am not able to read this file to display image on my page by using Line2. It seems I am using wrong syntax to read this file within IMG SRC. Can you suggest right code? 

Line1:   $chart->render("libchart-1.3\libchart\demo\generated\demo25_'$email'.gif");
Line2:   echo '<img src="libchart-1.3\libchart\demo\generated\demo25_'$email'.gif">';

OR

Line1:   $chart->render("libchart-1.3\libchart\demo\generated\demo25_'$email'.gif");
Line2:   echo '<img src="libchart-1.3\libchart\demo\generated\demo25_<?php echo "$email".gif">';

Kindly suggest.

Thanks,
Regards,
Ankit Baphna

vars inside ' ' are treated as plain text
vars inside " " are treated as var
so
should work

echo "<img src='libchart-1.3\libchart\demo\generated\demo25_$email.gif'>";

also posible

echo '<img src="libchart-1.3\libchart\demo\generated\demo25_'.$email.'.gif">';

Thanks this worked. I used your first example. But not able to delete this dynamic path file using below code.

Line4:
$file_to_delete2 = 'libchart-1.3\libchart\demo\generated\demo25_$email.gif';

it does not just comes out of loop without deleting file.

File name is: demo25_'ankit.baphna@gmail.com'.gif

static file name works
Line5: $file_to_delete = 'libchart-1.3\libchart\demo\generated\demo3.gif';

But line 4 does not do anything. Kindly suggest

Regards,
Ankit Baphna

Even deletion is working now. THank you for very important tip of '' and " "

Regards,
Ankit Baphna

Hi Friends,

somehow now I am again not able to get gif display with same code where it was working earlier.

Line1:
$chart->render("libchart-1.3\libchart\demo\generated\demo25_'$email'.gif");
Line2:
echo "<img src='libchart-1.3\libchart\demo\generated\demo25_$email.gif'>";
Line3:
$file_to_delete2 = "libchart-1.3\libchart\demo\generated\demo25_'$email'.gif";

Line 1 and Line 3 is working but Line2 is not working now. Its not displaying gif file.

Regards,
Ankit Baphna

Ok strange I just changed quotes and now line2 is working.

Can you verify if this code is correct?

Correct code is:
Line1:
$chart->render("libchart-1.3\libchart\demo\generated\demo25_'$email'.gif");
Line2:
echo "<img src=libchart-1.3\libchart\demo\generated\demo25_'$email'.gif>";
Line3:
$file_to_delete2 = "libchart-1.3\libchart\demo\generated\demo25_'$email'.gif";

echo "<img src=libchart-1.3\libchart\demo\generated\demo25_'$email'.gif>";

Just use {} within quotes and you will be okay.

echo "<img src=libchart-1.3\libchart\demo\generated\demo25_{$email}.gif>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.