Page 3 of 5

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:17 pm
by EcazS
Kamal wrote:
<?php
function download($url, $save_to){
    if(file_put_contents($save_to, file_get_contents($url))){
        return true;
    }else {
        return false;
    }
}
?>
Isn't it that simple?
If I wanted to save the actual site (HTML) then yes, it would be that easy.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:28 pm
by bowersbros
in that case, you need to read the source using the file_get_contents, then use a regular expression to sort out all the images within that page. Then use that function on the image URLs and it will download all images on a webpage.

(Note. you can also just use the direct image url if you know it with the current function for it to work)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:29 pm
by EcazS
bowersbros wrote: (Note. you can also just use the direct image url if you know it with the current function for it to work)
I could just right click on the image and save it then.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:31 pm
by bowersbros
Yes. which is why i also suggested the way to do it automatically..

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:39 pm
by Carbine
I have actually made a thumbnailer which resizes the image, and recentantly created a function that changes the size of a jpeg image :L I could upload it if you like?

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:51 pm
by jacek
Carbine wrote:I have actually made a thumbnailer which resizes the image, and recentantly created a function that changes the size of a jpeg image :L I could upload it if you like?
That sounds perfect. It could just be used directly but I may use it as part of a larger image manipulation thing.

You will have to zip any php files. but upload them / it as an attachment to this topic :D

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 8:52 pm
by Carbine
Well I'm currently thinking about learning the GD Libary, and I could create a few functions I suppose. It seems interesting enough to not make me bored...

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 1:10 pm
by libeco
So who will be the first to set up a GIT repository for this? ;)

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 2:08 pm
by jacek
libeco wrote:So who will be the first to set up a GIT repository for this? ;)
Not me ;)

It's too much of a pain to use, although I guess it would be useful when there is more than one person contributing ;)

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 2:18 pm
by libeco
And that's where an IDE can prove itself. Painstakingly easy, just hit commit, do a pull and push, no writing command line crap in a terminal, console or whatever it's called... :D

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 3:04 pm
by jacek
gEdit has a git plugin ! thats very handy !

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 3:58 pm
by Kamal
I'll set one up.
What should I call it and what should the description be?

Re: BetterPHP PHP Library

Posted: Sat May 14, 2011 4:29 pm
by jacek
Kamal wrote:I'll set one up.
What should I call it and what should the description be?
Don't do that, I am doing it now.

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 10:35 am
by Kamal
jacek wrote:
Kamal wrote:I'll set one up.
What should I call it and what should the description be?
Don't do that, I am doing it now.
Ok. It shouldn't be hard though.

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 10:42 am
by jacek
Kamal wrote:Ok. It shouldn't be hard though.
It wasn’t ;)

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 2:31 pm
by Kamal
jacek wrote:
Kamal wrote:Ok. It shouldn't be hard though.
It wasn’t ;)
Good, now give us the link :D

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 3:12 pm
by jacek
Kamal wrote:Good, now give us the link :D
I did, its in the first post.

If you have something to add I can make you a contributor.

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 3:34 pm
by nyo
This is a great idea, just noticed this thread. Today I started to build my own library as well, but it consists of some very basic things (notes, code pieces, functions, etc.) that I will be using frequently. I want to contribute to this thread later though.

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 3:44 pm
by jacek
We need basic stuff too, if you have any useful functions fee free to post them :D

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 6:00 pm
by Kamal
jacek wrote:If you have something to add I can make you a contributor.
jacek wrote:We need basic stuff too, if you have any useful functions fee free to post them :D
I may have some useful files stored somewhere on my computer.. I'll look for them

EDIT: Found these files:
php classes and functions.zip
(12.51 KiB) Downloaded 402 times
They are probably yours.. also they are quite helpful

Re: BetterPHP PHP Library

Posted: Sun May 15, 2011 6:05 pm
by jacek
Yes they are mine :lol:

They are also the ones in the git if you bothered to look ! :shock: