Re: [PHP] Why is my class throwing this error?

2005-02-17 Thread NathanielGuy#21
Thanks to you all, the problem ended up being me leaving off a sigle
quote in a function declared before.  8_  I didnt expect that to be
the error because I was thinking it would flag it much sooner in my
script than it did.  Thanks for the help.

--nathan

On Thu, 17 Feb 2005 11:48:12 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 NathanielGuy#21 wrote:
  function displaygallery($user = FALSE, $lastprinted = 0, $move =
  'forward', $limit = 10) {//Line 52
 
  Error thrown
  --
  Parse error: parse error, unexpected T_STRING in
  /home/blacknut/public_html/picserv/includes/gallery.class on line 52
 
 You probably have a missing ' or  somewhere BEFORE line 52.
 
 And probably in the stuff you chopped out, since others ran the code you
 provided with no error.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 


-- 
http://www.blacknute.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Why is my class throwing this error?

2005-02-16 Thread NathanielGuy#21
Hello again list,
Im writing a class to display a bunch of pictures form my DB and when
I call a function through the class I get an error and I dont quite
understand why.  Now Im fairly new to classes so this might be
something that is totally obvious, but I cant seem to figure it out.
The code below is that which produces the error.  The error is thrown
if i pass values to the function or not.  If i take the default string
for $move out it works fine until I need to test the value of $move on
line 54. the same error is thrown on that line.  It doesnt make sens
to me.  All help is appreciated, thanks much!


gallery2.php
--
include('./includes/gallery.class');
$gal1 = new Gallery;
$gal1-displaygallery(FALSE, 0, 'forward', 10);
--


gallery.class
--
class Gallery {

//Edited out to save space

//Special Page Constructs
function displaygallery($user = FALSE, $lastprinted = 0, $move =
'forward', $limit = 10) {//Line 52
 while ($num_pics_printed = $limit) {
  if ($move == 'forward') {//Line 54
 $nextprint = $lastprinted++;
 }
else {
 $nextprint = $lastprinted--;
 }
  $printing_pic_values = grabpicinfo($nextprint);
  if (canuserseepic($user, $printing_pic_values)) {
   $mysql_select_user_values = mysql_fetch_assoc(mysql_query('SELECT
user_sn FROM Users WHERE user_id=' .
$printing_pic_values['pic_user']));

   $folder_path = strtolower($mysql_select_user_values['user_sn']) . '/';
   print 'div class=gallery_containera href=pictures/' .
$folder_path . $printing_pic_values['pic_id'] . '.pngimg
src=pictures/' . $folder_path . $printing_pic_values['pic_id'] .
't.png alt=' . $printing_pic_values['pic_title'] . ' //abr
/div class=gallery_comment' .
$printing_pic_values['pic_descript'] . '/div/div' . \n\n;
   }
  }
 }
}
--


Error thrown
--
Parse error: parse error, unexpected T_STRING in
/home/blacknut/public_html/picserv/includes/gallery.class on line 52
--

--nathan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Connecting To Multiple MySQL Databases

2005-02-05 Thread NathanielGuy#21
Worked like a charm, thanks!
--nathan


On Thu, 03 Feb 2005 20:33:17 -0700, Dan Trainor [EMAIL PROTECTED] wrote:
 NathanielGuy#21 wrote:
  I know this may be slightly off topic for a PHP listserv but I cant
  find my answer anywhere else.  I start off generating a page connected
  to one database as a certain user and I call a script that requires a
  connection to a second database as a different user.  Is there any way
  I could open that connection while maintaining the current one aswell?
   The connection of the script is opend and closed before any more of
  the other page is generated.  Im not sure how to go about solving this
  problem other than rewriting my script.  Any ideas?
 
  --nathan
 
 
 I'm a bit new myself, but why not call the resources seperate names?
 
 $sql1 = mysql_connect($host1, $user1, $pass1);
 
 $sql2 = mysql_connect($host2, $user2, $pass2);
 
 Hope that helps
 -dant
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
http://www.blacknute.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Connecting To Multiple MySQL Databases

2005-02-03 Thread NathanielGuy#21
I know this may be slightly off topic for a PHP listserv but I cant
find my answer anywhere else.  I start off generating a page connected
to one database as a certain user and I call a script that requires a
connection to a second database as a different user.  Is there any way
I could open that connection while maintaining the current one aswell?
 The connection of the script is opend and closed before any more of
the other page is generated.  Im not sure how to go about solving this
problem other than rewriting my script.  Any ideas?

--nathan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image Creation and Saving

2005-01-30 Thread NathanielGuy#21
Ah, thank you.  after checking that the folder was there I found I had
made a mistake in the path to the folder. 8_ I can believe I didnt
find it before.  Aside from that error, did I go about the image
resizing and everything in the correct way?  What is the use of
imagecreatetruecolor().  Thanks for the help.

--nathan


On Sun, 30 Jan 2005 00:52:06 -0800, hitek [EMAIL PROTECTED] wrote:
 Are you making sure the $_SESSION['user_sn'] folder exists before saving
 the image into it?
 I'm asking because I originally thought it was a permission problem but php
 will tell you 'permission denied' if that was the case.
 
 
 At 05:05 PM 1/29/2005, NathanielGuy#21 wrote:
 Hello everyone,
 I have been troubleshooting a problem with one of my scripts for a
 while now, its purpose is to allow a user to upload a file, save it to
 the server, resize it into a thumbnail, and save the thumbnail as
 well.  In my script all goes well until it comes to saving the images,
 the script throws these errors:
 
 Warning: imagepng(): Unable to open
 '/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15.png'
 for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on
 line 91
 
 Warning: imagepng(): Unable to open
 '/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15t.png'
 for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on
 line 95
 Picture ffq was added to our database! The following is what we have
 generated and it is what others will see
 
 Here is the important part of the script, if more is needed i can post
 it as well.
 
  if ($mime_type == 'jpeg') {
  $new_image = imagecreatefromjpeg($_FILES['new_image']['tmp_name']);
 //Create an image refrence
  }
  elseif ($mime_type == 'png') {
  $new_image = imagecreatefrompng($_FILES['new_image']['tmp_name']);
 //Create an image refrence
  }
  elseif ($mime_type == 'gif') {
  $new_image = imagecreatefromgif($_FILES['new_image']['tmp_name']);
 //Create an image refrence
  }
 
//Image Sizes
  list($new_image_width, $new_image_height) =
 getimagesize($_FILES['new_image']['tmp_name']);//Get img size
  if ($new_image_width  $new_image_height) {//Get thumb size
  $percent_image_size = (200 / $new_image_width);
  }
  elseif ($new_image_width  $new_image_height) {
  $percent_image_size = (200 / $new_image_height);
  }
  else {
  $percent_image_size = (200 / $new_image_height);
  }
  $new_thumb_width = ($percent_image_size * $new_image_width);
  $new_thumb_height = ($percent_image_size * $new_image_height);
 
  $new_thumb_file = imagecreatetruecolor($new_image_width,
  $new_image_height);
imagepng($new_image,
 '/home/blacknut/public_html/picserv/picserv_mysql/pictures/' .
 strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . '.png');
 //Copy pic to user dir as pic_id.png
 
  $new_thumb_image = imagecreatetruecolor($new_thumb_width,
 $new_thumb_height); // Create Thumb file
  imagecopyresampled($new_thumb_image, $new_image, 0, 0, 0, 0,
 $new_thumb_width, $new_thumb_height, $new_image_width,
 $new_image_height); //Copy resized to new thumb file
  imagepng($new_thumb_image,
 '/home/blacknut/public_html/picserv/picserv_mysql/pictures/' .
 strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . 't.png');
 //Save image thumb
 
 I am very new to file/image manipulation in php so if you see any
 errors, or unnecessary code please tell me.  I'm not quit sure how
 everything works, although I do have a theoretical picture of how it
 does.  Any comments will be appreciated.
 
 --nathan
 
 --
 http://www.blacknute.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
http://www.blacknute.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Image Creation and Saving

2005-01-29 Thread NathanielGuy#21
Hello everyone,
I have been troubleshooting a problem with one of my scripts for a
while now, its purpose is to allow a user to upload a file, save it to
the server, resize it into a thumbnail, and save the thumbnail as
well.  In my script all goes well until it comes to saving the images,
the script throws these errors:

Warning: imagepng(): Unable to open
'/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15.png'
for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on
line 91

Warning: imagepng(): Unable to open
'/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15t.png'
for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on
line 95
Picture ffq was added to our database! The following is what we have
generated and it is what others will see

Here is the important part of the script, if more is needed i can post
it as well.

if ($mime_type == 'jpeg') {
 $new_image = imagecreatefromjpeg($_FILES['new_image']['tmp_name']);
//Create an image refrence
 }
elseif ($mime_type == 'png') {
 $new_image = imagecreatefrompng($_FILES['new_image']['tmp_name']);
//Create an image refrence
 }
elseif ($mime_type == 'gif') {
 $new_image = imagecreatefromgif($_FILES['new_image']['tmp_name']);
//Create an image refrence
 }

  //Image Sizes
list($new_image_width, $new_image_height) =
getimagesize($_FILES['new_image']['tmp_name']);//Get img size
if ($new_image_width  $new_image_height) {//Get thumb size
 $percent_image_size = (200 / $new_image_width);
 }
elseif ($new_image_width  $new_image_height) {
 $percent_image_size = (200 / $new_image_height);
 }
else {
 $percent_image_size = (200 / $new_image_height);
 }
$new_thumb_width = ($percent_image_size * $new_image_width);
$new_thumb_height = ($percent_image_size * $new_image_height);

$new_thumb_file = imagecreatetruecolor($new_image_width, 
$new_image_height);
  imagepng($new_image,
'/home/blacknut/public_html/picserv/picserv_mysql/pictures/' .
strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . '.png');
//Copy pic to user dir as pic_id.png

$new_thumb_image = imagecreatetruecolor($new_thumb_width,
$new_thumb_height); // Create Thumb file
imagecopyresampled($new_thumb_image, $new_image, 0, 0, 0, 0,
$new_thumb_width, $new_thumb_height, $new_image_width,
$new_image_height); //Copy resized to new thumb file
imagepng($new_thumb_image,
'/home/blacknut/public_html/picserv/picserv_mysql/pictures/' .
strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . 't.png');
//Save image thumb

I am very new to file/image manipulation in php so if you see any
errors, or unnecessary code please tell me.  I'm not quit sure how
everything works, although I do have a theoretical picture of how it
does.  Any comments will be appreciated.

--nathan

-- 
http://www.blacknute.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php