Jump to content


Photo

impossible error!!!!


  • Please log in to reply
6 replies to this topic

#1 norman100

norman100
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 01 June 2006 - 08:38 PM






Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image.

at the moment as it is it just shows one hugh image ,

another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything

somebody please help sort this out ! Im just completely out of solutions

thanks for your time

n


#2 norman100

norman100
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 01 June 2006 - 08:58 PM

[!--quoteo(post=379168:date=Jun 1 2006, 03:38 PM:name=norman100)--][div class=\'quotetop\']QUOTE(norman100 @ Jun 1 2006, 03:38 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image.

at the moment as it is it just shows one hugh image ,

another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything

somebody please help sort this out ! Im just completely out of solutions

thanks for your time

n
[/quote]


[a href=\"http://69.9.45.42/~nirmal/MESSAGE.txt\" target=\"_blank\"]http://69.9.45.42/~nirmal/MESSAGE.txt[/a]


Hi guys sorry about the above it wouldnt let me post the entire message, see the above text file

dont load it in ur browsers because it doesnt open as a text file but in some different way !

please take alook guys

#3 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 01 June 2006 - 08:59 PM

Do you have example code that we can look at, to see where it is going wrong?
PHP Ninja

#4 norman100

norman100
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 01 June 2006 - 09:01 PM

[!--quoteo(post=379175:date=Jun 1 2006, 03:58 PM:name=norman100)--][div class=\'quotetop\']QUOTE(norman100 @ Jun 1 2006, 03:58 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
[a href=\"http://69.9.45.42/~nirmal/MESSAGE.txt\" target=\"_blank\"]http://69.9.45.42/~nirmal/MESSAGE.txt[/a]
Hi guys sorry about the above it wouldnt let me post the entire message, see the above text file

dont load it in ur browsers because it doesnt open as a text file but in some different way !

please take alook guys
[/quote]


IF YOU RIGHT CLICK AND SAVE THE FILE IT SHOULD BE COOL RATHER THEN CLICKING THROUGH THE LINK!

#5 cody7

cody7
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 01 June 2006 - 09:24 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image.[/quote]

please check getimagesize() function to retrieve image size.. hope this helps.


#6 norman100

norman100
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 01 June 2006 - 10:10 PM

[!--quoteo(post=379185:date=Jun 1 2006, 04:24 PM:name=cody7)--][div class=\'quotetop\']QUOTE(cody7 @ Jun 1 2006, 04:24 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
please check getimagesize() function to retrieve image size.. hope this helps.
[/quote]


Codey i have identified that function as problematic, i dont know if you looked at the txt file?

<?php

####################################################################################
include('../includes/general.php');
include('../includes/print_date.php');
include('../includes/db_connect.php');
#####################################################################################

##Script that allows the administrator to delete and download tracks

$query = "select * from tracks";

$result =mysql_query($query);

$num_rows=mysql_num_rows($result);

##YES WE HAVE RECORDS

IF ($num_rows > 0) {


echo "<center><h2>Delete or download existing tracks</h2></center>";

echo "<br><br>";

####################################################################################
##DIRECTORIES REQUIRED FOR THE DISPLAYING OF FILES

$music="music/";

$pics="pics/";

$music_directory=$directory.$music;

$pic_directory=$directory.$pics;

//$newdir="../files/";


####################################################################################

//LETS PRINT THE TABLE



echo "<br><hr><center><b>Tracks available for deletion or download</b></center><br>";


echo "<center>";

echo "<TABLE BORDER='4' BORDERCOLOR='#990000' CELLPADDING='2' CELLSPACING='2' WIDTH='49%'>";
echo "<TR>";
echo "<TD>Picture!</TD><TD>Track-Name</TD><TD>Description</TD><TD>Genre</TD>
<TD>Artist</TD><TD>Duration</TD><TD>Filesize</TD><TD>Operations</TD>

";
echo "</TR>";


//Lets loop through the database getting the information we need!
//$result was collected at the start of the code


$opendir1 =opendir($pic_directory);



$opendir2 =opendir($music_directory);


while ($row = mysql_fetch_array($result))


{

$track_id=$row['track_id'];

$trackname=$row['trackname'];

$description=$row['description'];

$genre=$row['genre'];;

$artist=$row['artist'];

$duration=$row['duration'];

$filename=$row['filename'];

$picture=$row['picture'];


// since i am using gallery we have to get the width and hieght of photos.




///$picture2="3.jpg";

$imgsize = getimagesize($pic_directory.$picture); /////////HERES THE PROBLEM

//$imgsize = getimagesize($upload."/".$filename);


// lets get the file size in byte/kb/mb.

$file_size = filesize($music_directory.$filename);

if ($file_size >= 1048576){
$show_filesize = number_format(($file_size / 1048576),2) . " MB";
}elseif ($file_size >= 1024){
$show_filesize = number_format(($file_size / 1024),2) . " KB";
}elseif ($file_size >= 0){
$show_filesize = $file_size . " bytes";
}else{
$show_filesize = "0 bytes";
}

if ($imgsize[0] > 100){
$base_img = "<img src=\"$pic_directory$picture\" border=\"0\" width=\"100\">";
}else{
$base_img = "<img src=\"$pic_directory$picture\" border=\"0\">";
}



//lets print each row


echo "<TR>";

echo "<TD>
<a href=\"javascript:popimg('$pic_directory$picture','$picture', $imgsize[0], $imgsize[1],'white')\">
$base_img</a>

</TD>

<TD><center>$trackname</center></TD>


<TD><center>$description</center></TD>


<TD><center>$genre</center></TD>


<TD><center>$duration</center></TD>";


//Lets get the artist name in a comparable analogous manner

#############################################################################################
$artistname = "select forename, surname from artists where username = '$artist'";
$resulter = mysql_query($artistname);

while ($row = mysql_fetch_array($resulter))

{

$FORENAME=$row['forename'];
$SURNAME=$row['surname'];

echo "<TD><center>$FORENAME\n$SURNAME</center></TD>";

}

#############################################################################################

//LETS PRINT THE FILESIZE


echo "<TD><center>$show_filesize</center></TD>";


//LETS PROVIDE NICE DELETE AND DOWNLOAD LINKS


echo "<TD><center>




[[<A HREF=\"$music_directory$filename\">Download</A> ]]




[[<A HREF=\"per_delete.php?row_ID=$track_id\">Delete</A>]]

</center></TD>";



}


echo "</TR>";

echo "</center></table>";




closedir($opendir1);

closedir($opendir2);

clearstatcache();


}

ELSE {

echo "<center>";
ECHO "<H2><B>No Tracks Have Been Added Yet!</B><H2>";
echo "</center>";

echo "<CENTER><a href='track_form.php'
class='displayText'>Add</font></a><br></CENTER>";

echo "<CENTER><a href='index.php'
class='displayText'>Home</font></a><br></CENTER>";






}

?>



MESSAGE !




Ok the script above creates a kind of gallery page, the problem im having is that the getimagesizefunction is not working and is refusing to open my file

$imgsize = getimagesize($pic_directory.$picture); /////////HERES THE PROBLEM



$file_size = filesize($music_directory.$filename);


The path has to be correct because the filesize is working fine and its path is virtually the same , just a different folder


$music="music/";

$pics="pics/";

$music_directory=$directory.$music;

$pic_directory=$directory.$pics;



Whats happening is because i cant retrieve the image size it blows the javascript pop up function out because it requires them parameters to work ie height and width of the image.

at the moment as it is it just shows one hugh image ,

another funny thing is when i changed the name of the variable $picture in the fetch array loop it just failed to show anything

somebody please help sort this out ! Im just completely out of solutions

thanks for your time

n


#7 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 01 June 2006 - 10:47 PM

try this
list($width, $height, $type, $attr) = getimagesize($pic_directory.$picture);

you'll get the $width and $height as variables. Also make sure all you paths are correct and there are actuall images.

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users