php-general Digest 30 Apr 2011 14:49:07 -0000 Issue 7290

Topics (messages 312577 through 312592):

Re: gd Graphics Library Question (EXIF)
        312577 by: Mitch
        312588 by: Stuart Dallas

Re: Wiki formatting class or something similar
        312578 by: Gerardo Benitez
        312587 by: Stuart Dallas
        312590 by: Peter Lind

postgresql database access failure
        312579 by: e-letter

Why Constants could Not be Array?
        312580 by: Walkinraven
        312586 by: Stuart Dallas

dynamic copyright in page footer?
        312581 by: David Mehler
        312582 by: Simon J Welsh
        312583 by: dholmes1031.gmail.com
        312585 by: Geoff Lane
        312591 by: Nathan Rixham
        312592 by: Mark Kelly

Re: Flattery will get you nowhere
        312584 by: Marc Guay

Re: What's faster using if else or arrays?
        312589 by: Stuart Dallas

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- I was wondering about that. Since I am not actually hosting my ISP would have to have it loaded (or compiled into their PHP implementation), right?

I'll have to do some legwork with my ISP and ImageMagic

On 4/29/2011 9:26 AM, Stuart Dallas wrote:
On Friday, 29 April 2011 at 03:33, Mitch wrote:
I have written a lightweight, easy to use photo album "system" in
HTML/PHP/MySQL.In addition to the Photo Album side I have written a
series of Admin Utilities to manage it with. One of the administrative
utilities uploads photos from my local drive, resizes them to be more
efficient on disk space, creates thumbnails and populates the database
with as much "default" data as can be deduced.

After all of this was written, I decided to see if I could pull EXIF
data to supply some of the technical data for the DB. To my surprise,
the only EXIF data in the JPEG files was data in the File, Computed and
Comments sections.

Why don't the gd utilities retain the original EXIF data? Is there any
way to do so? I use the following gd utilities to resize and create the
new JPEG image files:

imagecreatefromjpeg
imagesx
imagesy
imagercreatetruecolor
imagecopyresized
imagejpeg

This is a known shortcoming of the GD library. You won't have that issue with 
ImageMagick: http://php.net/book.imagick

-Stuart



--- End Message ---
--- Begin Message ---
On Saturday, 30 April 2011 at 03:32, Mitch wrote:
I was wondering about that. Since I am not actually hosting my ISP would 
> have to have it loaded (or compiled into their PHP implementation), right?

You may be able to use http://php.net/dl to load the extension (you'll need to 
build it to be compatible with your host and then upload it) but it's highly 
unlikely they'll have the dl function enabled. Your best bet is to ask them to 
add it to their environment.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



> On 4/29/2011 9:26 AM, Stuart Dallas wrote:
> > On Friday, 29 April 2011 at 03:33, Mitch wrote:
> > I have written a lightweight, easy to use photo album "system" in
> > > HTML/PHP/MySQL.In addition to the Photo Album side I have written a
> > > series of Admin Utilities to manage it with. One of the administrative
> > > utilities uploads photos from my local drive, resizes them to be more
> > > efficient on disk space, creates thumbnails and populates the database
> > > with as much "default" data as can be deduced.
> > > 
> > > After all of this was written, I decided to see if I could pull EXIF
> > > data to supply some of the technical data for the DB. To my surprise,
> > > the only EXIF data in the JPEG files was data in the File, Computed and
> > > Comments sections.
> > > 
> > > Why don't the gd utilities retain the original EXIF data? Is there any
> > > way to do so? I use the following gd utilities to resize and create the
> > > new JPEG image files:
> > > 
> > > imagecreatefromjpeg
> > > imagesx
> > > imagesy
> > > imagercreatetruecolor
> > > imagecopyresized
> > > imagejpeg
> > 
> > This is a known shortcoming of the GD library. You won't have that issue 
> > with ImageMagick: http://php.net/book.imagick
> > 
> > -Stuart
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Hi Andre,

I did a intranet with TextWiki (
http://pear.php.net/package/Text_Wiki/redirected )
TextWiki is a reliable Class to create Wiki using Php.

Regards.
Gerardo.


On Fri, Apr 29, 2011 at 6:04 PM, Andre Polykanine <[email protected]> wrote:

> Hi everyone,
> I  allow my users to put some Html into their blogs. I filter it using
> a  great  tool  called HtmLawed and written by Dr. Santosh Patnaik (if
> you're reading this, many thanks to you!).
> However, I would like to give them a possibility to mark-up their text
> in  a  more  convenient  way  for beginners (such as Wiki or something
> similar).
> I searched through http://phpclasses.org/ but didn't find anything.
> Could you suggest me something?
> And one more question: maybe some of you already have a handy solution
> to process smilies? Say, a user writes ":)" and this is replaced by an
> image in my directory.
> Thanks in advance!
>
>
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez
-------------------------
www.webseficientes.com.ar
Diseño web, programación, Seo

--- End Message ---
--- Begin Message ---
On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
Hi everyone,
> I allow my users to put some Html into their blogs. I filter it using
> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
> you're reading this, many thanks to you!).
> However, I would like to give them a possibility to mark-up their text
> in a more convenient way for beginners (such as Wiki or something
> similar).
> I searched through http://phpclasses.org/ but didn't find anything.
> Could you suggest me something?
> And one more question: maybe some of you already have a handy solution
> to process smilies? Say, a user writes ":)" and this is replaced by an
> image in my directory.
> Thanks in advance!

Markdown is a pretty good option for a wiki: 
http://michelf.com/projects/php-markdown/

Textile is another option (and supports tables which markdown does not): 
http://textile.thresholdstate.com/

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/






--- End Message ---
--- Begin Message ---
On 30 April 2011 15:13, Stuart Dallas <[email protected]> wrote:
> On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote:
> Hi everyone,
>> I allow my users to put some Html into their blogs. I filter it using
>> a great tool called HtmLawed and written by Dr. Santosh Patnaik (if
>> you're reading this, many thanks to you!).
>> However, I would like to give them a possibility to mark-up their text
>> in a more convenient way for beginners (such as Wiki or something
>> similar).
>> I searched through http://phpclasses.org/ but didn't find anything.
>> Could you suggest me something?
>> And one more question: maybe some of you already have a handy solution
>> to process smilies? Say, a user writes ":)" and this is replaced by an
>> image in my directory.
>> Thanks in advance!
>
> Markdown is a pretty good option for a wiki: 
> http://michelf.com/projects/php-markdown/
>
> Textile is another option (and supports tables which markdown does not): 
> http://textile.thresholdstate.com/
>

MarkItUp is a favourite plugin editor of mine - will allow you to work
with a lot of different syntaxes and users don't need to know them.

http://markitup.jaysalvat.com/home/

If you're considering sanitizing html instead of using a markup
language to convert into html, I'd read
http://blog.astrumfutura.com/2010/08/html-sanitisation-the-devils-in-the-details-and-the-vulnerabilities/
before settling on any tool to do the job. Far as I can tell, HtmLawed
isn't actually capable of sanitizing properly, according to the author
- unless it's since been updated to fix the problems mentioned in the
blog.

Regards
Peter

-- 
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>

--- End Message ---
--- Begin Message ---
Readers,

A postgresql database (local disk installation) is successfully
accessed as a normal user:

psql -U username databasename

However, creating a php file to access the database has not been successful.

<html>
<body>
        <?php
                $db = pg_connect('dbname=databasename user=username');
                $query = 'SELECT * FROM databasename';
                $value=pg_fetch_result($query,1,0);
                echo 'export of database is ',$value,'';
        ?>
        <p>
                why does this fail?
        </p>
        </body>
</html>

The following php code produces the user agent:

        <?php
                echo '$_SERVER['HTTP_USER_AGENT']';
        ?>

--- End Message ---
--- Begin Message ---
For needing a constants=array, I have to use
'public static $a = array(...)'

instead.

Why the language could not relax the restriction of constants?

--- End Message ---
--- Begin Message ---
On Saturday, 30 April 2011 at 10:51, Walkinraven wrote:
For needing a constants=array, I have to use
> 'public static $a = array(...)'
> 
> instead.
> 
> Why the language could not relax the restriction of constants?

As I understand it constants must be declarations not evaluations because 
they're initialised during parsing not execution. Arrays are evaluations even 
if they only contain literal values. It could be done, but it would require a 
fundamental change to the engine and the benefit-cost calculation just doesn't 
add up.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/






--- End Message ---
--- Begin Message ---
Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:

<?php
echo date ('Y');
?>

This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

--- End Message ---
--- Begin Message ---
On 30/04/2011, at 11:06 PM, David Mehler wrote:

> Hello,
> 
> I am trying to use php to put a copyright notice in a page footer. I'm
> using the date function with the "Y" value for the year. Here's the
> code:
> 
> <?php
> echo date ('Y');
> ?>
> 
> This works great for a site done in 2011 but next year I'm going to
> want to have 2011 and 2012 in the copyright notice, adding an
> additional year the site's up. I'd appreciate some suggestions i'm
> very likely overthinking this.
> 
> Thanks.
> Dave.

I would use something simple like:
if(date('Y') == '2011') {
        echo '2011';
} else {
        echo '2011-', date('Y');
}

---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e


--- End Message ---
--- Begin Message ---
Something simple like this would work 
$date=date('Y');
$startdate='2011';
if($date == $startdate) {
echo $startdate
} else {
Echo $startdate;
Echo '-';
echo  $date;

}
Sent via BlackBerry from T-Mobile

-----Original Message-----
From: David Mehler <[email protected]>
Date: Sat, 30 Apr 2011 07:06:17 
To: php-general<[email protected]>
Subject: [PHP] dynamic copyright in page footer?
Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:

<?php
echo date ('Y');
?>

This works great for a site done in 2011 but next year I'm going to
want to have 2011 and 2012 in the copyright notice, adding an
additional year the site's up. I'd appreciate some suggestions i'm
very likely overthinking this.

Thanks.
Dave.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
On Saturday, April 30, 2011, Simon J Welsh wrote:

> I would use something simple like:
> if(date('Y') == '2011') {
>         echo '2011';
> } else {
>         echo '2011-', date('Y');
> }

... or in one line:

echo (date('Y') != '2011' ? '2011-' : '') . date('Y');

However, you might want to change that to:

echo '2011-' . date('Y');

at the first review after the start of 2012!

HTH,

-- 
Geoff


--- End Message ---
--- Begin Message ---
David Mehler wrote:
Hello,

I am trying to use php to put a copyright notice in a page footer. I'm
using the date function with the "Y" value for the year. Here's the
code:

<?php
echo date ('Y');
?>

echo implode(",", range(2011,date("Y")));

--- End Message ---
--- Begin Message ---
On Saturday 30 Apr 2011 at 14:28 Nathan Rixham wrote:

> echo implode(",", range(2011,date("Y")));

What an elegant solution! Thank you.

--- End Message ---
--- Begin Message ---
>  Dinna know bats even _had_ eyelids....

They increase the effectiveness of evil spells by 50%, especially when
coupled with Frogs Tears (tm).

--- End Message ---
--- Begin Message ---
On Saturday, 30 April 2011 at 03:17, Tamara Temple wrote:

> On Apr 29, 2011, at 8:32 AM, Robert Cummings wrote:
> 
> > On 11-04-29 08:04 AM, Steve Staples wrote:
> > > On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
> > > > On 11-04-28 06:37 PM, [email protected] wrote:
> > > > > Thanks switch and case seems to be more faster for the job and a 
> > > > > lot cleaner
> > > > > ------Original Message------
> > > > > From: Andre Polykanine
> > > > > To: [email protected]
> > > > > Cc: [email protected]
> > > > > Subject: Re: [PHP] What's faster using if else or arrays?
> > > > > Sent: Apr 28, 2011 6:17 PM
> > > > > 
> > > > > Hello Dholmes1031,
> > > > > 
> > > > > I would write it like this:
> > > > > switch($foo) {
> > > > >  case 5: $dothis; break;
> > > > > case 3: $dothat; break;
> > > > > default: $donothing; break;
> > > > > }
> > > > 
> > > > This sounds like a job for *dun dun dun* GOTO!
> > > > 
> > > > Kidding, of course ;)
> > > > 
> > > > Cheers,
> > > > Rob.
> > > > --
> > > 
> > > you should be removed and banned from this list for even just 
> > > THINKING
> > > about using a GOTO! :P
> > > 
> > > (yes, there are still *SOME* (and i use that loosely) benefits to the
> > > GOTO command, but in reality, no.)
> 
> People, people, don't you realize that break IS a goto?? It's just one 
> of limited scope.

By that logic, so is a function call.

Hey, hey... what do you call a group of gotos?

.

.

.

A CLASS!! Bwhahahahahahahahahaaaaa. Not!

Happy Saturday all :)

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/





--- End Message ---

Reply via email to