PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 7th, 2003, 01:36 PM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 12
Send a message via AIM to jben.net
simple show image script (php)

Hi,

I'm trying to write a simple script that outputs a html file with an image (the url for which comes from a var)

php:
PHP Code:
<?php

/*

    show_image.php
*/

$imageURL stripslashes($imageURL);

$imgSize getimagesize($imageURL$info);

$imgW $imgSize[0];

$imgH $imgSize[1];

echo 
"$imgW<br>$imgH<br>";

echo 
"<html>\n<head><title>VickyDevine: Image Detail.</title>\n";

echo 
"<SCRIPT type='text/Javascript'>\n";
echo 
"<!--\nif ((parseInt(navigator.appVersion)>3)) {top.resizeTo('$imgW','$imgH')}\;\n";
echo 
"//-->\n</SCRIPT>";

echo 
"</head>\n";

echo 
"<body>\n";

echo 
"<img src=\"./$imageURL\" border='0'>\n

Last edited by jben.net : July 7th, 2003 at 01:39 PM.

Reply With Quote
  #2  
Old July 7th, 2003, 01:38 PM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 12
Send a message via AIM to jben.net
post truncated (again!)

continued from before...

PHP Code:
echo "</body>\n</html>";

?> 


Everytime I call the page, ie http://www.mydomain.com/show_image....ges/myImage.jpg it gives me this error...

Warning: Unexpected character in input: ' in /home/www/audiofer/vicky_devine/show_image.php on line 28

Warning: Unexpected character in input: ' in /home/www/audiofer/vicky_devine/show_image.php on line 28

Any ideas why ??

I'm also trying to resize the page when it loads with javascript, with the width and height being determined using getimagesize. When I echo the $imgW and $imgH vars they return the correct values but the page doesn't resize, again, any ideas why ??

thanks in advance,

Jon

Reply With Quote
  #3  
Old July 7th, 2003, 01:48 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via ICQ to dhouston
I don't know if you mispasted or if this is the error, but you don't close your quote or have a semi-colon on the following line:

PHP Code:
echo "<img src=\"./$imageURL\" border='0'>\n 


If that's not the problem, make sure you point out what's on line 28. It's hard to count accurately here in the forums.

As for resizing the window, please please don't. In some browsers, if the window's resized by javascript, then any time you open your program, it defaults to the last size it was resized to. This is very irritating if you like your windows to open maximized. If you insist on doing it, check out devguru's javascript reference on the window object to see the specification for resizing. It may be that you don't need quotes around the values.

Reply With Quote
  #4  
Old July 7th, 2003, 02:13 PM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 12
Send a message via AIM to jben.net
hi,

Yep, that's the offending line:

PHP Code:
echo "<img src=./$imageURL border='0'>\n 


But what's wrong with it ???? $imageURL is just a string, and the image loads on the page fine, so why it is throwing errors ?

On the resize front, this is for a flash site, that's opened in a chromless window anyway, so I guess I will have pissed off a lot of people anyway so a few more won't matter !

Thanks,

Jon

Reply With Quote
  #5  
Old July 7th, 2003, 02:18 PM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 12
Send a message via AIM to jben.net
right, resizing works fine now, it was the single quotes around the w/h vars.

stil getting the same unexpected character in input bollax though, dam.

Jon

Reply With Quote
  #6  
Old July 7th, 2003, 03:13 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via ICQ to dhouston
You're lacking a closing quotation mark and a semi-colon on this line:

PHP Code:
echo "<img src=\"./$imageURL\" border='0'>\n 


It should read:

PHP Code:
echo "<img src=\"./$imageURL\" border='0'>\n"

Reply With Quote
  #7  
Old July 8th, 2003, 05:50 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 12
Send a message via AIM to jben.net
thanks, that's sorted it.

If you want to see it in action (and all the other things I've banging on about)...

test site (unfinished)

Jon

Last edited by jben.net : July 8th, 2003 at 05:52 AM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > simple show image script (php)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap