Forum Moderators: coopster

Message Too Old, No Replies

getimagesize loop?

         

amwd07

7:22 pm on Sep 18, 2007 (gmt 0)

10+ Year Member



Hello

Not sure if this is possible or I am going about this is the correct way?

Code:
<?php
list($width, $height, $type, $attr) = getimagesize("images/makers/16/tn/anthologia-mis16-10.jpg");
echo "Image width " .$width;
echo "<BR>";
echo "Image height " .$height;
echo "<BR>";
echo "Attribute " .$attr;
?>

what I would like to do is calulate all the image widths for the following recordset so each user would output a different value

for example there is 16 images for mis_id 16 so the total width would be 2080px
the reason I need this value is because I have a image scroller but this requires a width: as each members gallery will be different

<?php
$colname_gallery = "-1";
if (isset($_GET['mis_id'])) {
$colname_gallery = $_GET['mis_id'];
}
mysql_select_db($database_mis, $mis);
$query_gallery = sprintf("SELECT * FROM members_gallery WHERE user_id = %s", GetSQLValueString($colname_gallery, "int"));
$gallery = mysql_query($query_gallery, $mis) or die(mysql_error());
$row_gallery = mysql_fetch_assoc($gallery);
$totalRows_gallery = mysql_num_rows($gallery);

$galleryimage=mysql_result($gallery,$i,"gallery_image");
?>

jatar_k

8:40 pm on Sep 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are the widths stored in the db? you could select a SUM as part of your query if they are.

otherwise your loop would probably work, seems like a lot of work every time though

amwd07

9:01 pm on Sep 18, 2007 (gmt 0)

10+ Year Member



any other suggestions?

the width are not yet in the DB if I can insert them into DB when I upload an image that would be fine mayb ejust use hidden field in the form but what do put to get the image width of uploading file?
I could do a sum in the query but how do I get to that stage or is there another way of totaling the image widths in a query without inserting to DB?

all need is to get a figure for $total width for example 16 images would be 2020px

<div id="scroll" style width=$totalwidth">

jatar_k

12:17 pm on Sep 19, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



does the loop work?