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-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 meta 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

?
   //every expire header under the sun
   header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);
   header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
   header(Cache-Control: no-store, no-cache, must-revalidate);
   header(Cache-Control: post-check=0, pre-check=0, false);
   header(Pragma: no-cache);


   //so far this is the only refresh that works as it forces the page to
   //expire and reload itself - causes ugly screen redraw
   if(isset($reload))
 echo meta HTTP-EQUIV=\refresh\ CONTENT=\0;
URL=./view.phtml?pic=$pic\;

   //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=$picreload=true);
   }

   //Script to set the image size according to browser size
   echo script
 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);
 } 
 /script;
   

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

   //build the screen
   echo ibImage/b/i -  . $pic;
   echo hr;
   echo center;
   echo img src=$pic_file onload='draw_image(. $width . ,  . $height .
)';
   echo brfont size=-1i(Image Details: width -  . $width
 . , height -  . $height
 . , size -  . $size . k) /i/font;

   //user options to rotate or return to the index page
   echo p
 a href=$PHP_SELF?pic=$picro=CCW[Rotate CCW]/anbsp
 a href=./index.phtml?ref=true[HOME]/anbsp
 a href=$PHP_SELF?pic=$picro=CW[Rotate CW]/a/p;
   echo /center;
   echo hr;

   //a bit of self promotion
   echo ifont size=-1bPicture Viewer/b
 - Developed by Whitehouse Productions 2001/font/i;

?
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

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]