0
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

Edited by ankit.baphna

3
Contributors
6
Replies
23
Views
3 Years
Discussion Span
Last Post by sftranna
1

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">';
0

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

0

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

Regards,
Ankit Baphna

0

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

0

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";

0

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>";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.