Est. 2003
Home Help Login Register
News: Welcome to ZboX Webhosting.
10 Megs

10 MB Disk
1 GB Transfer
$10.00 per year
25 Megs

25 MB Disk
2 GB Transfer
$25.00 per year
50 Megs

50 MB Disk
3 GB Transfer
$50.00 per year
75 Megs

75 MB Disk
4 GB Transfer
$75.00 per year
500 Megs

500 MB Disk
10 GB Trans
$100.00 yr.

+  ZboX Webhosting Est. 2003. Now in our Fourth year!
|-+  Help!
| |-+  Problems and/or Questions
| | |-+  PHP CODING QUESTION
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: PHP CODING QUESTION  (Read 1378 times)
pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


PHP CODING QUESTION
« on: February 24, 2007, 02:14:17 AM »

HI ALL:

DOES ANYBODY IN HERE KNOW HOW TO ADD CODE TO A PHP SCRIPT?

I HAVE THIS GREAT SCRIPT
FROM ZBOX. HOWEVER, I WOULD LIKE TO BE ABLE TO ADD VARIABLES GIVING ME THE WIDTH AND HEIGHT OF THE IMAGE IN THE VIEWER???

WOULD ANYBODY KNOW THESE?

http://s25test.zboxhosting.com/ack.html

THANK YOU

SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
dlilahl
Mega ZboXian
***
Offline Offline

Posts: 99



Re: PHP CODING QUESTION
« Reply #1 on: February 24, 2007, 08:02:17 AM »

Scarlet..hi. 

I have a php code to show size underneath individual images that might be incorporated into ths Browse script.  Bert might be able to help with this.  (hint) 

Seems like the script would almost have to be rewritten for anything else.  HTH

lila ©

PS. I will see if I can change this..also, let me know if you want the size script.
« Last Edit: March 21, 2007, 06:02:53 AM by dlilahl » Logged
dlilahl
Mega ZboXian
***
Offline Offline

Posts: 99



Re: PHP CODING QUESTION
« Reply #2 on: February 24, 2007, 08:33:27 AM »

Scarlet...just in case... here are some things that I posted about your question.

http://www.dlilahl.zboxhosting.com/PHPfunc/1gives_size.php


http://dlilahl.zboxhosting.com/PHPfunc/1gives_size.txt       

The below is text from the Browse script which may tell us something as to how it could or could not work well. Quote:
- i have added a new varible (scale) to decide if you want to scale
             
the pictures that do not excede the max width/height variable
- fixed a bug where images that were wider than tall could exceed

the max height varible and images that were taller than wide could exceed the max width variable

HTH
lila ©
« Last Edit: February 24, 2007, 08:44:20 AM by dlilahl » Logged
MisRox
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 232



Re: PHP CODING QUESTION
« Reply #3 on: February 24, 2007, 08:34:58 AM »

Scarlet..hi. 

I have a php code to show size underneath individual images that might be incorporated into ths Browse script.  Brian might be able to help with this.  (hint) 

Seems like the script would almost have to be rewritten for anything else.  HTH

lila ©

PS. I will see if I can change this..also, let me know if you want the size script.


HI SCARLET, LILA,
I PLAYED AROUND AND GOOGLED BUT COULDN'T FIGURE OUT HOW TO ADD THE SIZE AND WIDTH UNDER THE IMAGE. I AM NOT PHP SAVY..LOL

LILA, BRAIN? blink

YOU MAY BE RIGHT. THE SCRIPT MAY HAVE TO BE REWRITTEN...BUT I WOULDN'T KNOW HOW. HOPE YOU MAY BE ABLE FIGURE SOMETHING OUT.

IF ANYONE ELSE KNOWS ANYTHING..PLEASE POST.

...;-) ROX
Logged

Visit Me at:
garenasix
Posting Maniac
*****
Offline Offline

Posts: 233



Re: PHP CODING QUESTION
« Reply #4 on: February 24, 2007, 06:52:55 PM »

i found this dont know if it will help you

Getting Started

Let's say you have a great line of socks that you want to sell through your site. Well, you're proud of these fantastic socks and want people to see as much of them as possible: on the product views page, on the search page, on the listing page, etc. But this doesn't mean that you have to use the default image size each time, nor risk the quality of the image being degraded when it is stretched or crunched into a space. Some socks are longer than others and so you might have the image sizes ranging from 200x400 up to 600x750 pixels.

To begin writing the function, we have to declare it as such... Then we have to throw in our attributes. We want to restrict our image, so we have to let the function know the dimensions to which we want to restrict it, and we have to know what the original image size is to begin with (we'll get to that part in a second).

<?php

function imageResize($width, $height, $target) {

//takes the larger size of the width and height and applies the 
formula accordingly...this is so this script will work 
dynamically with any size image

if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}

//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);

//returns the new sizes in html image tag format...this is so you
can plug this function inside an image tag and just get the

return "width=\"$width\" height=\"$height\"";

}

?>

Before we take our new function on a test drive, we need to get the width and height of the image that we want to display. There is a magical command in PHP called getimagesize(). This command, used properly, will return the image width, height, type, and even the width and height in HTML image tag format (width="x" height="y").

$mysock = getimagesize("images/sock001.jpg");

Now, $mysock is an array that holds vital information about the particular image we want to display. In index 0, we have the width ($mysock[0]), and in index 1, we have the height ($mysock[1]). That's really all we need, in order to get what we want done. Want to see the function... well, function? Here we go!
The Function in Action

Let's say you want to display a list of your beautiful socks, but you want room on the page to show them neatly in a row, and to do that they cannot be larger than 150 pixels tall or wide.

<?php

//get the image size of the picture and load it into an array
$mysock = getimagesize("images/sock001.jpg");

?>

<!-using a standard html image tag, where you would have the 
width and height, insert your new imageResize() function with 
the correct attributes -->

<img src="images/sock001.jpg" <?php imageResize($mysock[0], 
$mysock[1], 150); ?>>

That's it! Now, no matter what the original file size, it will be restricted to no more than 150 pixels in width or height (or whatever you specify).

Now, you may think "This sounds too good to be true. Is there any circumstance where using this technique could prove disastrous?"

Actually, there is. Keep in mind that you aren't changing the file's original size. That same 200x400, 50 KB picture you uploaded only moments ago is still 200x400, 50 KB. This script only changes height and width attribute in HTML, so that your original picture conforms to the height and width you think will look best on your Web page.

Having said that, if you have a page that lists 50-something products, the page will display the way you want it to, but uses will have to download all 50 of those 50 KB pictures, which could take some time. So I'd have to recommend this technique in situations where you're only showing a few pictures at a time.
« Last Edit: February 24, 2007, 06:54:48 PM by garenasix » Logged



pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #5 on: February 24, 2007, 10:22:44 PM »

HI ALL:

UHHHH....eeeeeeeeeek!!!
MORE CAFE, POR FAVOR? LOL

I JUST GOT ONLINE AND I AM NOT PROCESSING YET. I HAVE TO STUDY THE LAST RESPONSE.

THANK YOU ALL SOOOOO MUCH FOR HELPING ME?

I AM NOT SURE WHAT TO DO WITH WHAT YOU HAVE SAID THOUGH? I AM THAT DUHHHHH RE: PHP. I FEEL VERYY SATISFIED IF I CAN GO IN AND JUST CHANGE PARMS IN A SCRIPT WITHOUT BLOWING IT UP. LOLOL

YESTERDAY,,,, I FOUND THIS!!!

$old_x=imageSX($src_img);
$old_y=imageSY($src_img);

IT SUPPOSEDLY IS SUPPOSED TO DISPLAY
THE WIDTH AND HEIGHT SIZE.

I DON*T NEED THE WIDTH AND HEIGHT OF THE THUMBNAILS BUT THE ORIGINAL (OR ONE DISPLAYED AT TOP) IMAGE.

HOWEVER,,,,,IF THIS DOES NOT WORK AND,,,, I HAVE NO IDEA WHERE TO
"STICK IT" (BE NICE :-)))

THEN I AM AFRAID I WILL WIND UP GETTING INTO MORE AND MORE TROUBLE WHEN I HAVE ALREADY RECONFIGURED THE SCRIPT TO WHAT I WANT IT TO LOOK LIKE.

IT ALSO DAWNED ON ME THAT I HAVE OTHER PHP IMAGE VIEWERS THAT DO DISPLAY HEIGHT AND WIDTH BUT, AGAIN, SAME PROBLEM?

THE SCRIPTS WHEN LOOKED AT, SEEM SO SPECIFIC RE: WHERE TO PUT WHAT PARAMETERS THAT EVEN IF I HAVE THE PARMS.
I HAVE NOOOO IDEA WHERE TO PLACE THEM?

AGAIN,,,, I WILL HAVE TO STUDY

IS THAT A VALID QUESTION OR TOO EARLY?

HOW DOES A PERSON KNOW , IF ONE FINDS PARAMETER CODE TO USE,
WHERE TO PLACE IT WITHIN THE SCRIPT? (THESE SCRIPTS SEEM VERY TAILOR MADE)

THANK YOU
SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #6 on: March 01, 2007, 05:38:12 AM »

HI ALL:

WELL, I FINALLY GOT A BUNCH OF OTHER PROBLEMS SOLVED AND I AM BACK ON THIS ONE.

GARENASIX,,,,I AM TRYING TO DISPLAY ON THE VIEWER THE HEIGHT AND WIDTH.

DO I USE THE CODE YOU POSTED IN YOUR REPLY?

IF SO, WHERE DO I PUT IT IN THE SCRIPT?

RE: THE CODE I POSTED THAT I HAD FOUND. ??????
FAWGET IT???

I SEARCHED AND SEARCHED. THERE ARE SOOO MANY PLACES THAT ONE IS BETTER OFF TALKING TO "REAL" PEOPLE WHO KNOW WHAT THEY ARE DOING. LIKE YOU :-)

I ONLY NEED TO DISPLAYED THE IMAGE HEIGHT AND WIDTH OF THE MAIN IMAGE AT THE TOP THAT WILL BE SHOWING , NOT THE THUMBNAILS.

IF THERE IS A WAY, GREAT.
IF NOT, THAT IS FINE TOO.

THANK YOU
SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
daysjourney
Newbie
*
Offline Offline

Posts: 2



Re: PHP CODING QUESTION
« Reply #7 on: March 01, 2007, 06:42:05 AM »

Hi Everyone,

I am a long time lurker but this is my first post.
I have been using a CGI image_lister viewer script
from Ultra's free scripts. This viewer includes the height and width of all the images in a directory.
Just beam in the Zip file below to any directory where you want it. The Zip has two files including a readme
file, but basically all you have to do is CHMOD the
image_lister.cgi file to 755 and click on it.

http://lanny.zboxhosting.com/temporary/image_lister1.zip

Lanny

 
Logged
ZboX
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 1491


What 'ya got there??


Re: PHP CODING QUESTION
« Reply #8 on: March 01, 2007, 03:42:51 PM »

Hi Everyone,

I am a long time lurker but this is my first post.
I have been using a CGI image_lister viewer script
from Ultra's free scripts. This viewer includes the height and width of all the images in a directory.
Just beam in the Zip file below to any directory where you want it. The Zip has two files including a readme
file, but basically all you have to do is CHMOD the
image_lister.cgi file to 755 and click on it.

http://lanny.zboxhosting.com/temporary/image_lister1.zip

Lanny

 

Well done on your first post Lanny. Hope to see more of ya.

~;-)

Bert
Logged

Homepage / Community: http://zboxhosting.com

Contact: sales@zboxhosting.com
"When all is said and done, there's nothing left to say or do!"
pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #9 on: March 09, 2007, 01:04:28 AM »

HI LANNY: THANK YOU FOR THE INFO BUT I ALREADY HAVE IT, HAVE FOR YEARS. THEN I FOUND ONE THAT I COULD ADJUST THE CODE TO CHANGE THE SIZE OF THE THUMBNAILS BY RIVERDRIFT. HOWEVER, COMPARED TO THE SCRIPT THAT BERT RECENTLY GAVE ME, IT LOADS VERY SLOWLY AND FILLS UP WEBTV USER'S CACHE VERY QUICKLY.

THE ONE I POSTED IS GREAT FOR RATE OF LOADING , BEING ABLE TO CHANGE THUMBNAIL SIZES AND NUMBER OF THUMBNAILS PER ROW. HOWEVER, IT DOES NOT HAVE 2 THINGS THAT IMAGERS GO ACCORDING TO WHEN LOOKING AT GRAPHICS,,THE NAMES OF THE IMAGES AND THE HEIGHT AND WIDTH.

THAT IS WHY I HAVE BEEN ASKING IF ANYONE WHO KNOWS HOW TO CODE PHP COULD HELP ME CODE THIS PROGRAM? IF WE HAD THOSE OPTIONS SHOWN TO US ALSO, THAT IMAGE VIEWER WOULD BE AMAZING. IT ALREADY IS THE BEST ONE I HAVE SEEN.

BTW, IF ANYBODY ELSE HAPPENS TO HAVE ANY SCRIPTS FOR IMAGE VIEWERS, PLEASE GIVE A YELL?

OR, LIKE MY ORIGINAL QUESTION,
COULD HELP FIGURE OUT HOW TO CODE THIS ONE TO SHOW TITLES AND HEIGHT AND WIDTH?

THANK YOU,
SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #10 on: March 09, 2007, 01:12:44 AM »

GARENASIX, LILA:

THANX SO MUCH FOR YOUR HELP. I ALREADY CHANGED THE CODE. I CHANGED THE BGCOLOR, I ADDED SOME TITLES, I CHANGED THE SIZE OF THE THUMBNAILS, HOW MANY PER ROW. I FIGURED OUT THE PARAMETERS THAT WERE THERE AND JUST CHANGED THE NUMBERS.

HOWEVER, RE: ADDING SHOWING THE TITLES AND IMAGE'S
HEIGHT AND WIDTH IS A COMMAND THAT IS NOT THERE.

THAT IS WHAT I AM HAVING TROUBLE FINDING FOR I KNOW NOTHING RE: PHP. I JUST TRY TO FIGURE OUT WHAT COMMANDS ARE ALREADY FOR WHAT AND CHANGE ACCORDINGLY BUT I AM UNABLE, DUE TO LACK OF KNOWLEDGE IN THIS AREA, WHAT PHP COMMANDS/CODES ARE.

I HAVE OTHER IMAGE LISTERS THAT SHOW THE TITLES AND SIZES OF THE IMAGES BUT I DON'T KNOW THEM TO BE ABLE TO RECOGNIZE THEM AND RECREATE IN THIS SCRIPT. OTHERWISE I WOULD TRY THAT.

SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
garenasix
Posting Maniac
*****
Offline Offline

Posts: 233



Re: PHP CODING QUESTION
« Reply #11 on: March 11, 2007, 08:34:25 AM »

n/p wish i could be more help im not really all that big on PHP and CSS and not even javascript anymore
Logged



pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #12 on: March 11, 2007, 09:07:39 AM »

GARENASIX, ALL:
THANK YOU FOR YOUR INFORMATION FROM BEFORE THAT IS GOOD FOR LEARNING PURPOSES.

RIGHT NOW, THOUGH, I DON'T HAVE TIME TO LEARN PHP BUT....I WOULD LIKE TO PLUG IN SOME CODE.

I FOUND THE NECESSARY CODE FOR
-ADDING NAMES
-ADDING HEIGHT AND WIDTH

IN AN IMAGE VIEWER.

IT IS IN THIS VIEWER THAT I HAVE:

http://piratevoyager.com/0--JAN07/TEST/1-viewer.php

THIS IS THE NEW VIEWER THAT I WANT TO ADD IT TO:

http://piratevoyager.com/0--JAN07/TEST/1NEWVIEWERfeb07.php

WOULD YOU OR ANYBODY ELSE KNOW WHERE I COULD PLUG IN THE PART THAT SAYS
"DISPLAYS NAME" DISPLAYS HEIGHT AND WIDTH"

***IT IS NEAR THE VERY BEGINNING.

I DON'T KNOW IF PHP WORKS IN AN ORDERLY FASHION, IE. THE COMMANDS HAVE TO BE PUT IN A CERTAIN WAY OR IS IT A PROGRAM THAT THE COMMANDS JUST HAVE TO BE THERE BY THE TIME IT IS LOADED?

MEBEEE ANYBODY WHO HAS HAD ANYTHING TO DO WITH PHP COULD TELL ME WHERE TO PUT IT?

(BE NICE...LOLOLOL)

AGAIN THANK YOU

SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
ZboX
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 1491


What 'ya got there??


Re: PHP CODING QUESTION
« Reply #13 on: March 11, 2007, 04:07:50 PM »

GARENASIX, ALL:
THANK YOU FOR YOUR INFORMATION FROM BEFORE THAT IS GOOD FOR LEARNING PURPOSES.

RIGHT NOW, THOUGH, I DON'T HAVE TIME TO LEARN PHP BUT....I WOULD LIKE TO PLUG IN SOME CODE.

I FOUND THE NECESSARY CODE FOR
-ADDING NAMES
-ADDING HEIGHT AND WIDTH

IN AN IMAGE VIEWER.

IT IS IN THIS VIEWER THAT I HAVE:

http://piratevoyager.com/0--JAN07/TEST/1-viewer.php

THIS IS THE NEW VIEWER THAT I WANT TO ADD IT TO:

http://piratevoyager.com/0--JAN07/TEST/1NEWVIEWERfeb07.php

WOULD YOU OR ANYBODY ELSE KNOW WHERE I COULD PLUG IN THE PART THAT SAYS
"DISPLAYS NAME" DISPLAYS HEIGHT AND WIDTH"

***IT IS NEAR THE VERY BEGINNING.

I DON'T KNOW IF PHP WORKS IN AN ORDERLY FASHION, IE. THE COMMANDS HAVE TO BE PUT IN A CERTAIN WAY OR IS IT A PROGRAM THAT THE COMMANDS JUST HAVE TO BE THERE BY THE TIME IT IS LOADED?

MEBEEE ANYBODY WHO HAS HAD ANYTHING TO DO WITH PHP COULD TELL ME WHERE TO PUT IT?

(BE NICE...LOLOLOL)

AGAIN THANK YOU

SCARLET


HI SCARLET.
YOU KNOW I JUST REMEMBERED THERE IS A WEBTV NEWSGROUP DEDICATED TO PHP. MAYBE THEY COULD BE OF SOME HELP?

~;-)

BERT
Logged

Homepage / Community: http://zboxhosting.com

Contact: sales@zboxhosting.com
"When all is said and done, there's nothing left to say or do!"
dlilahl
Mega ZboXian
***
Offline Offline

Posts: 99



Re: PHP CODING QUESTION
« Reply #14 on: March 19, 2007, 07:43:01 AM »

HI SCARLET, LILA,
I PLAYED AROUND AND GOOGLED BUT COULDN'T FIGURE OUT HOW TO ADD THE SIZE AND WIDTH UNDER THE IMAGE. I AM NOT PHP SAVY..LOL

LILA, BRAIN? blink

YOU MAY BE RIGHT. THE SCRIPT MAY HAVE TO BE REWRITTEN...BUT I WOULDN'T KNOW HOW. HOPE YOU MAY BE ABLE FIGURE SOMETHING OUT.

IF ANYONE ELSE KNOWS ANYTHING..PLEASE POST.

...;-) ROX

I do have something wrong with my brain. But I am taking meds for it.  It's a disease that is called POST trama.  rolleyes
lila
Logged
MisRox
Founder
Administrator
Posting Maniac
*****
Offline Offline

Posts: 232



Re: PHP CODING QUESTION
« Reply #15 on: March 19, 2007, 11:04:31 AM »

I do have something wrong with my brain. But I am taking meds for it.  It's a disease that is called POST trama.  rolleyes
lila


rofl02 Lila

That just shows my brain was getting ahead of my fingers!  laugh I believe I meant "Brian". LOL

...;-) Rox
Logged

Visit Me at:
pirate
ZboXian
**
Offline Offline

Posts: 32


TE NAMASTE,SCARLET


Re: PHP CODING QUESTION
« Reply #16 on: March 23, 2007, 04:18:27 AM »

 headbang

I FOUND SOME MORE CODE FOR ADDING IMAGE SIZES BUT I GUESS YOU FOLKS ANSWERED THE PROVERBIALLY BOTTOM LINE WHICH IS THE CODE HAS TO BE IN A CERTAIN ORDER= REPROGRAMMING THE WHOLE THING.

PHP ? NOT ME...LOL

SPEAKING OF BRAIN BRIAN SOUNDS FREUDIAN? :-)))

IS THAT WHAT KITTY IS FOR?
MEEEEEE-OWWWWW!!!!!

WELL, IT'S ON THE BOARD, IF ANY PHP GURU IS BORED,,FEEL LIKE BUILDING AN IMAGE VIEWER WITH THE WORKS,,,
TO GO?

STARBUCKS IS ON ME!!!

SCARLET
Logged

Please visit me and my site
SCARLET CENTRAL
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

ZboX Webhosting Est. 2003. Now in our Fourth year! | Powered by SMF 1.0.10.
© 2005, Simple Machines LLC. All Rights Reserved.
Page created in 0.112 seconds with 21 queries.