doctorbill
asked on
php and filesize
On the attached page, the following scripts wotk fine with a static image:
--------------------------
<?php
echo filesize("downloads/pictur e3hr.jpg") ;
echo " File Size in Bytes";
?><br />
<?php
$f = "downloads/picture3hr.jpg" ;
$size = filesize($f) * .000001;
echo $f . " is " . $size . " Mega bytes.";
?>
----------------------
The above scripts were used just to test the page
I am trying to get the file size from the following code being fed from a mysql recordset:
------------------
<?php do {
?>
<img src="<?php echo $row_imgs[im_thumb]; ?>" border="0" /><a href="download.php?file=<? php echo $row_imgs[im_hres]; ?>">D</a>
<?php } while ($row_imgs = mysql_fetch_assoc($imgs)); ?>
-------------------
Can someone please point me in the direction of how to add the filesize function to this loop so that it returns to file size for all returned records
index.php
--------------------------
<?php
echo filesize("downloads/pictur
echo " File Size in Bytes";
?><br />
<?php
$f = "downloads/picture3hr.jpg"
$size = filesize($f) * .000001;
echo $f . " is " . $size . " Mega bytes.";
?>
----------------------
The above scripts were used just to test the page
I am trying to get the file size from the following code being fed from a mysql recordset:
------------------
<?php do {
?>
<img src="<?php echo $row_imgs[im_thumb]; ?>" border="0" /><a href="download.php?file=<?
<?php } while ($row_imgs = mysql_fetch_assoc($imgs));
-------------------
Can someone please point me in the direction of how to add the filesize function to this loop so that it returns to file size for all returned records
index.php
ASKER
Doesn't work - all I get is the echo of the script on the page
Can you show us a full screenshot?
ASKER
The following is repeated down the page next to each image:
----------------------
$f = $row_imgs["im_thumb"]; $size = filesize($f) * .000001; echo $f . " is " . $size . " Mega bytes.";
----------------------
$f = $row_imgs["im_thumb"]; $size = filesize($f) * .000001; echo $f . " is " . $size . " Mega bytes.";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I get the following next to the relevant image:
FW_001.jpg is 0 Mega
FW_002.jpg is 0 Mega
FW_003.jpg is 0 Mega
So it is working in terms of the script on the page but no size is being returned
FW_001.jpg is 0 Mega
FW_002.jpg is 0 Mega
FW_003.jpg is 0 Mega
So it is working in terms of the script on the page but no size is being returned
ASKER
Correction - it is working. I didn't have the correct (full) image path in the database
ASKER
solved
Open in new window