php4

how to resize bmp,tiff image using gd library ? and also mention about imagemagick which is good to use [closed]

感情迁移 提交于 2019-12-05 07:42:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . i need to know which is better gd or imagemagick to resize an image 回答1: I like ImageMagick better. But I know GD it's pretty good too. Here's an example on how to resize an image using PHP: <?php if(!extension_loaded('imagick')) { dl('imagick.so'); } $img = strip_tags($_GET['imagename']); if(isset($_GET['size']

truly unique random number generate by php?

你离开我真会死。 提交于 2019-12-04 21:08:47
I'm have build an up php script to host large number of images upload by user, what is the best way to generate random numbers to image filenames so that in future there would be no filename conflict? Be it like Imageshack. Thanks. Keep a persistent list of all the previous numbers you've generated(in a database table or in a file) and check that a newly generated number is not amongst the ones on the list. If you find this to be prohibitively expensive, generate random numbers on a sufficient number of bits to guarantee a very low probability of collision. You can also use an incremental

PHP: get next 13 dates from date?

我是研究僧i 提交于 2019-12-04 04:43:04
问题 I am trying to get an array of a date plus the next 13 dates to get a 14 day schedule starting from a given date. here is my function: $time = strtotime($s_row['schedule_start_date']); // 20091030 $day = 60*60*24; for($i = 0; $i<14; $i++) { $the_time = $time+($day*$i); $date = date('Y-m-d',$the_time); array_push($dates,$date); } But it seems to be repeating a date when the month switches over.. this is what I get: 2009-10-30|2009-10-31|2009-11-01|2009-11-01|2009-11-02|2009-11-03|2009-11-04

PHP: Define function with variable parameter count?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 02:13:12
Is there a way to define a function in PHP that lets you define a variable amount of parameters? in the language I am more familiar with it is like so: function myFunction(...rest){ /* rest == array of params */ return rest.length; } myFunction("foo","bar"); // returns 2; Thanks! Yes. Use func_num_args() and func_get_arg() to get the arguments: <?php function dynamic_args() { echo "Number of arguments: " . func_num_args() . "<br />"; for($i = 0 ; $i < func_num_args(); $i++) { echo "Argument $i = " . func_get_arg($i) . "<br />"; } } dynamic_args("a", "b", "c", "d", "e"); ?> In PHP 5.6+ you can

how to resize bmp,tiff image using gd library ? and also mention about imagemagick which is good to use [closed]

北战南征 提交于 2019-12-03 21:51:50
i need to know which is better gd or imagemagick to resize an image I like ImageMagick better. But I know GD it's pretty good too. Here's an example on how to resize an image using PHP: <?php if(!extension_loaded('imagick')) { dl('imagick.so'); } $img = strip_tags($_GET['imagename']); if(isset($_GET['size'])) { $size = strip_tags($_GET['size']); } else { $size = 0; } if(isset($_GET['vsize'])) { $vsize = strip_tags($_GET['vsize']); } else { $vsize = 0; } $image = new Imagick($img); $image->thumbnailImage($size, $vsize); header("Content-type: image/png"); print $image; ?> Here is the link where

Your experience Moving PHP 4 to PHP 5 [closed]

孤人 提交于 2019-12-03 09:04:15
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . We have to move around 50+ Applications (small / large) to PHP 5.3 (from PHP 4.1). Does some has any experience with such an task?

Your experience Moving PHP 4 to PHP 5 [closed]

こ雲淡風輕ζ 提交于 2019-12-02 23:10:02
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. We have to move around 50+ Applications (small / large) to PHP 5.3 (from PHP 4.1). Does some has any experience with such an task? Time needed Tools Best setup for environment (Servers/Test?) Does it make sense to move first to PHP 5.2? Is there any way to

Getting error database not selected

你离开我真会死。 提交于 2019-12-02 15:41:16
问题 code: <?php session_start(); $_SESSION['msg'] = ""; $con = mysql_connect('localhost','me','omglol'); mysql_select_db('test',$con); $q = mysql_query(sprintf("select * from UserTable where (nick=\"%s\") AND (pass=SHA1(\"%s\"))",$_POST['nick'],$_POST['pass']),$con) or die(mysql_error()); This looks right to me. And yes I know 'test' exists. And contains UserTable. First, Thanks rid for adding php4 to the tags I forgot :( As per Laser_wizard's recommendations I did the following: (Entire Code): <

anonymous functions (lambdas, closures) in PHP 4

﹥>﹥吖頭↗ 提交于 2019-12-02 06:14:23
问题 Is there a trick in PHP 4 to implement functions which return functions? I expected that the following code would work: function xxx($a) { return function($b) { print "a=$a, b=$b \n"; } } $f1 = xxx(1); $f1(2); Unfortunately, no luck in PHP 4. Probably it works in PHP 5, but I limited to PHP 4. I tried to workaround with OO, but again failed (class declarations may not be nested): class Closure { function run($a) { print "raise: NotImplementedException, instead: $a\n"; } } class

anonymous functions (lambdas, closures) in PHP 4

自古美人都是妖i 提交于 2019-12-02 00:57:49
Is there a trick in PHP 4 to implement functions which return functions? I expected that the following code would work: function xxx($a) { return function($b) { print "a=$a, b=$b \n"; } } $f1 = xxx(1); $f1(2); Unfortunately, no luck in PHP 4. Probably it works in PHP 5, but I limited to PHP 4. I tried to workaround with OO, but again failed (class declarations may not be nested): class Closure { function run($a) { print "raise: NotImplementedException, instead: $a\n"; } } class WantCheckNesting extends Closure { function run($a, $b) { class Nested extends Closure { function run($c) { print "a=