Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetImageSize

Status
Not open for further replies.

gagz

Programmer
Nov 21, 2002
333
0
0
US
Does anyone know if GetImageSize was thrown to the curb in PHP 4.3.10? My isp just upgraded and now my scripts that use that function are all dead...

Thanks,
Marc
 
I have PHP 4.3.10 and GetImageSize works for me
you may have some other functions that use the GD library

you will want to make sure they(isp) have the GD library loaded in PHP

%, 2004

 
I am using this on php 5 and have not had any problems yet:
Code:
$imageInfo = getimagesize($form_data);
$width = $imageInfo[0];
$height = $imageInfo[1];

staffa
 
well i've found it wasn't a getimagesize problem, its an array problem but it makes not sense, as, like i said, the file hasn't changed in two years:

Code:
<?
include("header.html");
?>
<?

# program specific text
include($type.$year.".inc");

$portrait = array();
$landscape = array();

if ($dir = @opendir("./")) {
  while (($file = readdir($dir)) !== false) {
    if (ereg("(jpg)\$",$file) && ereg("^$type",$file) && ereg("$year",$file))
    {
       $imagesize = getimagesize("./".$file);
       #print $file . "<br>";
       # figure out landscape/portrait,for arrays
       $wth = intval($imagesize[0]);
       $hgt = intval($imagesize[1]);
       if (intval($hgt) > intval($wth))
       {
           array_push($portrait, $file);
       }
       else
       {
           array_push($landscape, $file);
       }
    }
  }
  closedir($dir);
}
print "<pre>";
print_r ($landscape);
print "</pre>";
# rifle through arrays, grouping jpg orientations together.
foreach($landscape as $val)
{
print $val."<br>";
       #$imagesize = GetImageSize("./".$val);
       $wth = intval($imagesize[0]);
       $hgt = intval($imagesize[1]);
       $factor = 150;
       $mult = $wth / $factor;
       $phgt = $hgt / $mult;
       $pwth = $wth / $mult;
       #print "<a href='$val'><img src='$val' width=$pwth height=$phgt border=0></a>\n";
}

foreach($portrait as $val)
{
#print "$val<br>";
       #$imagesize = GetImageSize("./".$val);
       $wth = intval($imagesize[0]);
       $hgt = intval($imagesize[1]);
       $factor = 150;
       $mult = $hgt / $factor;
       $phgt = $hgt / $mult;
       $pwth = $wth / $mult;
       #print "<a href='$val'><img src='$val' width=$pwth height=$phgt border=0></a>\n";
}

include("footer.html");
?>

the print_r works and prints fine. when i try to print the value of $val, its print "Array". when i a print statement in the for loop to print the value of $landscape[0], that works. What's going one, why isn't the value of $val coming out?? it's work for so long...

here's the page output:
Code:
Array
(
    [0] => ma-2004-18.jpg
    [1] => ma-2004-19.jpg
    [2] => ma-2004-21.jpg
    [3] => ma-2004-22.jpg
    [4] => ma-2004-23.jpg
    [5] => ma-2004-24.jpg
    [6] => ma-2004-26.jpg
    [7] => ma-2004-27.jpg
    [8] => ma-2004-29.jpg
    [9] => ma-2004-30.jpg
    [10] => ma-2004-40.jpg
    [11] => ma-2004-38.jpg
)

Array
Array
Array
Array
Array
Array
Array
Array
Array
Array
Array
Array

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top