BetterPHP PHP Library

Written something you are proud of, post it here.
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: BetterPHP PHP Library

Post by EcazS »

Kamal wrote:[syntax=php]<?php
function download($url, $save_to){
if(file_put_contents($save_to, file_get_contents($url))){
return true;
}else {
return false;
}
}
?>[/syntax]
Isn't it that simple?


If I wanted to save the actual site (HTML) then yes, it would be that easy.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post 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)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: BetterPHP PHP Library

Post 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.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

Yes. which is why i also suggested the way to do it automatically..
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Carbine
Posts: 58
Joined: Fri May 06, 2011 1:47 pm
Location: UK, Nottinghamshire
Contact:

Re: BetterPHP PHP Library

Post 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?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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
Image
Carbine
Posts: 58
Joined: Fri May 06, 2011 1:47 pm
Location: UK, Nottinghamshire
Contact:

Re: BetterPHP PHP Library

Post 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...
libeco
Posts: 104
Joined: Sat May 07, 2011 9:56 am

Re: BetterPHP PHP Library

Post by libeco »

So who will be the first to set up a GIT repository for this? ;)
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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 ;)
Image
libeco
Posts: 104
Joined: Sat May 07, 2011 9:56 am

Re: BetterPHP PHP Library

Post 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
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

gEdit has a git plugin ! thats very handy !
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post by Kamal »

I'll set one up.
What should I call it and what should the description be?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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.
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Kamal wrote:Ok. It shouldn't be hard though.

It wasn’t ;)
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post by Kamal »

jacek wrote:
Kamal wrote:Ok. It shouldn't be hard though.

It wasn’t ;)

Good, now give us the link :D
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post 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.
Image
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

Re: BetterPHP PHP Library

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

We need basic stuff too, if you have any useful functions fee free to post them :D
Image
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post 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 319 times

They are probably yours.. also they are quite helpful
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Yes they are mine :lol:

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