Hướng dẫn php echo image size

\n"; for ($col=1; $col<=4; $col++) { $f=$f+1; $getfile = $files[$f]; echo " \n"; for ($col=1; $col<=4; $col++) { $f=$f+1; $getfile = $files[$f]; $size = getimagesize($getfile); echo "

Asked 4 years, 3 months ago

Viewed 616 times

I try to put image size in image src tag, but it still does not work. The image can be displayed fine.

";

for ($row=1; $row <= 4; $row++) { 
    echo "
"; echo "

Nigel Ren

54.6k11 gold badges39 silver badges53 bronze badges

asked Jun 12, 2018 at 6:13

4

You can use getimagesize() function http://php.net/manual/en/function.getimagesize.php to fetch image size

";

    for ($row=1; $row <= 4; $row++) {
        echo "
"; echo "
Hướng dẫn php echo image size

Bhumi ShahBhumi Shah

8,9617 gold badges58 silver badges96 bronze badges

3

Not the answer you're looking for? Browse other questions tagged php or ask your own question.

I am echoing an image which works fine, but then i want to set how big it needs to be, and I just can't seem to get the syntax right.

This is what I have:

echo "

cyborg86pl

2,6082 gold badges26 silver badges44 bronze badges

asked Apr 22, 2014 at 15:43

0

You are mixing single and double quotes. So you get a syntax error.

This works:

echo " ';

answered Apr 22, 2014 at 15:46

Hướng dẫn php echo image size

theHackertheHacker

3,9341 gold badge18 silver badges30 bronze badges

try changing double quotes into single quotes for these attributes

height='130' width='150'

since double quotes are actually delimiting the PHP string. Optionally you may instead escape the double quotes like so

height=\"130\" width=\"150\"

but this syntax is less readable and more error prone (not recommended)

answered Apr 22, 2014 at 15:45

Hướng dẫn php echo image size

Fabrizio CalderanFabrizio Calderan

117k25 gold badges164 silver badges168 bronze badges

ok its here

echo '';

answered Apr 22, 2014 at 15:45

Hướng dẫn php echo image size

4

You can uses variables inside double quotes, like this:

Hướng dẫn php echo image size

Pedro LobitoPedro Lobito

88.2k29 gold badges238 silver badges256 bronze badges

Sometimes the way that you're using causes to errors if you don't do it properly.Therefore you can try this way also.


if you're using this inside a loop,you can do like this.




Hope this helped to you.

answered Apr 22, 2014 at 15:52

CodeCanyonCodeCanyon

9191 gold badge11 silver badges35 bronze badges

Not the answer you're looking for? Browse other questions tagged php html syntax or ask your own question.