Re: [PHP-DB] Image Sizes

2001-12-09 Thread Malcolm White

Sorry, I know this is for the wrong group - I just started here as the major
part of this app is related to a data base - this is just the fancy stuff at
the front. I have been able to get the screen to redraw by putting a
variable in the url that when set causes a  tag to be sent with a
refresh option - it is ugly as it causes the screen to draw then immediatly
redraw. I have tried all combinations of header()'s but I am missing something.

Thanks,

Malcolm


view.php

";

   //file containing various global variables
   include('./pview.inc');

   //build the complete path to the picture file
   $pic_file = $base_dir . $pic_dir_name . "/" . $pic;

   //rotate function - calls jpegtran to do the work
   function rotate($pic, $thu, $ro, $name){
  $temp_file = "/tmp/temp_pic";

  if($ro == "CCW")
 $rot = 270;
  else
 $rot = 90;

  exec("./jpegtran -rot $rot $pic> $temp_file");
  unlink($pic);
  copy($temp_file, $pic);
  unlink($temp_file);
  exec("./jpegtran -rot $rot $thu > $temp_file");
  unlink($thu);
  copy($temp_file, $thu);
  unlink($temp_file);
   }

   //if rotate variable is set then call rotate()
   if(isset($ro)){
  $thu_file = $base_dir . $thumb_dir_name . "/" 
  . $thumbnail_prefix . strtolower($pic);
  rotate($pic_file, $thu_file, $ro, $pic);

  //another attempted screen refresh. forces the meta tag
  header("Location: ./view.phtml?pic=$pic&reload=true");
   }

   //Script to set the image size according to browser size
   echo "
 function draw_image(width, height){
if(navigator.appName == 'Netscape' && document.layers != null){
   wid = window.innerWidth;
   hit = window.innerHeight;
}
if(document.all != null){
   wid = document.body.clientWidth;
   hit = document.body.clientHeight;
}
  
wFactor = wid / width;
hFactor = hit / height;
  
if(wFactor < hFactor)
   fact = wFactor;
else
   fact = hFactor;
   
fact = fact * 0.75;

nwid = width * fact;
nhit = height * fact;

document.images[0].height = Math.round(nhit);
document.images[0].width = Math.round(nwid);
 } 
 ";
   

   //get info abou the file for display
   list($width, $height) = GetImageSize($pic_file);
   $size = floor(filesize($pic_file) / 1024);

   //build the screen
   echo "Image - " . $pic;
   echo "";
   echo "";
   echo "";
   echo "(Image Details: width - " . $width
 . ", height - " . $height
 . ", size - " . $size . "k) ";

   //user options to rotate or return to the index page
   echo "
 [Rotate CCW] 
 [HOME] 
 [Rotate CW]";
   echo "";
   echo "";

   //a bit of self promotion
   echo "Picture Viewer
 - Developed by Whitehouse Productions 2001";

?>
>X-POP3-Rcpt: mwhite@guru
>Return-Path: <[EMAIL PROTECTED]>
>From: "Jon Farmer" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>, "Malcolm White" <[EMAIL PROTECTED]>
>References: <[EMAIL PROTECTED]>
>Subject: Re: [PHP-DB] Image Sizes
>Date: Sun, 9 Dec 2001 08:43:39 -
>X-MSMail-Priority: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006
>
>> I slved it with a javascript function - now I can't get the page refresh
>to
>> work properly - I have implimented the ability to rotate the images but
>> although the image i rotated it's contents aren't. I have used all maner
>of
>> header()'s to try and solve it but it only works when I physically hit the
>> refresh button on the browser.
>
>OK well can you show us the code? As you dont give much to go on. BTW you
>are posting to the wrong list you should use the PHP-General list as this
>list is for database issues.
>
>--
>Jon Farmer
>Systems Programmer, Entanet www.enta.net
>Tel 01952 428969 Mob 07763 620378
>PGP Key available, send email with subject: Send PGP Key
>
>
>
>
---
|   WHITEHOUSE PRODUCTIONS|
|  Malcolm White  |
---
| ph:  +61 2 9798 4645|
| fax: +61 2 9716 6097|
| mob: +61 414 860 742| 
| mob fax: +61 414 860 745|
| email:   [EMAIL PROTECTED]  |
| web: www.whitehouseprod.com.au  |
---


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Image Sizes

2001-12-09 Thread Jon Farmer

> I slved it with a javascript function - now I can't get the page refresh
to
> work properly - I have implimented the ability to rotate the images but
> although the image i rotated it's contents aren't. I have used all maner
of
> header()'s to try and solve it but it only works when I physically hit the
> refresh button on the browser.

OK well can you show us the code? As you dont give much to go on. BTW you
are posting to the wrong list you should use the PHP-General list as this
list is for database issues.

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Image Sizes

2001-12-09 Thread Malcolm White

Thanks,

I slved it with a javascript function - now I can't get the page refresh to
work properly - I have implimented the ability to rotate the images but
although the image i rotated it's contents aren't. I have used all maner of
header()'s to try and solve it but it only works when I physically hit the
refresh button on the browser.

At 07:33 09/12/2001 -, you wrote:
>> I have a database that stores the location of image files - the images are
>> all of different sizes. How can I get the screen size in order to scale
>the
>> images according to the users screen. I can use GetImageSize() to
>determine
>> the image size but cannot find a means of determining the screen size.
>
>
>You cant do this with PHP. You need to use a client side script (javascript)
>to determine the screen res and then pass that pack to PHP either through
>the query string or a form post.
>
>Regards
>
>Jon
>
>--
>Jon Farmer
>Systems Programmer, Entanet www.enta.net
>Tel 01952 428969 Mob 07763 620378
>PGP Key available, send email with subject: Send PGP Key
>
>
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
---
|   WHITEHOUSE PRODUCTIONS|
|  Malcolm White  |
---
| ph:  +61 2 9798 4645|
| fax: +61 2 9716 6097|
| mob: +61 414 860 742| 
| mob fax: +61 414 860 745|
| email:   [EMAIL PROTECTED]  |
| web: www.whitehouseprod.com.au  |
---


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Image Sizes

2001-12-08 Thread Jon Farmer

> I have a database that stores the location of image files - the images are
> all of different sizes. How can I get the screen size in order to scale
the
> images according to the users screen. I can use GetImageSize() to
determine
> the image size but cannot find a means of determining the screen size.


You cant do this with PHP. You need to use a client side script (javascript)
to determine the screen res and then pass that pack to PHP either through
the query string or a form post.

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]