OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 26 Mar 2005 15:27:04 -0000 Issue 3360

php-general-digest-helplists.php.net
Date: Sat Mar 26 2005 - 09:27:04 CST


php-general Digest 26 Mar 2005 15:27:04 -0000 Issue 3360

Topics (messages 211606 through 211618):

create multiple jpg thumbnails and use in a page
        211606 by: Kevin Coyner
        211608 by: Mike
        211614 by: Dotan Cohen

Re: html image
        211607 by: Matthew Fonda

Ending PHP
        211609 by: Marquez Design
        211610 by: Gerhard Pfeiffer
        211611 by: Matthew Fonda

Test Send
        211612 by: Juan Pablo Herrera

Re: Referer checking is able to be referer spoofed
        211613 by: Dan Rossi

Some help on using regex
        211615 by: Jamie

So this isnt a bug?
        211616 by: Aaron

Re: Problem with header in an if
        211617 by: Burhan Khalid

Re: Array problem
        211618 by: listas.uakari.com

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Is there a way to create multiple jpg thumbnails from a series of larger
originals and use all of the on-the-fly generated thumbnails in a page
(without saving any of the thumbnails to the filesystem)?

For example, I've got 5 full size jpg's in a directory, and I'd like to
list them on a page in table form as follows

image1.jpg thumnbnail image image1 size datestamp
image2.jpg thumnbnail image image2 size datestamp
image3.jpg thumnbnail image image3 size datestamp
image4.jpg thumnbnail image image4 size datestamp
image5.jpg thumnbnail image image5 size datestamp

From php.net, I've found plenty of examples of how to create thumbnails
from files and have done a couple successfully. My objective, however,
is to have a page dynamically create multiple thumbnails from full sized
images. I don't want to be creating and saving thumbnails to be used
later.

Possible? If so, then please just a pointer in the right direction.

Thanks, Kevin
--

attached mail follows:


 
Here's how I'd go about that -

1) create two pages
  a) the page that is displaying the images
  b) the script that generates the thumbnails

2) 'a' is simple - it just reads the directory and creates the HTML to
image_thumbnail.php?image=image.jpg

3) 'b' is passed 'image.jpg', reads the file, creates the thumbnail (rather
simple and lots of code in the manual and on the net) and outputs the proper
header info and the right data stream.

4) watch your performance drop and your scripts possibly time out

Simple matter of the fact is that image processing is a dog. It consumes a
lot of resources and has little gain for being done on-the-fly in most
situations. And when you think about it - you're taking a very large amount
of input to output the same exact thing - just smaller. While I know it's
very bad HTML practice, if this is a fast site, you might get faster page
loads by just loading the full image with the image tag set with height and
width constraints ;)

If it's not a heavy/fast site, it might not be a problem. But if it's under
any serious load, pending the image sizes, it might be a big hit.

Just my $.02.

-M

> -----Original Message-----
> From: Kevin Coyner [mailto:kevinrustybear.com]
> Sent: Friday, March 25, 2005 9:33 PM
> To: php-generallists.php.net
> Subject: [PHP] create multiple jpg thumbnails and use in a page
>
>
> Is there a way to create multiple jpg thumbnails from a
> series of larger originals and use all of the on-the-fly
> generated thumbnails in a page (without saving any of the
> thumbnails to the filesystem)?
>
> For example, I've got 5 full size jpg's in a directory, and
> I'd like to list them on a page in table form as follows
>
>
> image1.jpg thumnbnail image image1 size datestamp
> image2.jpg thumnbnail image image2 size datestamp
> image3.jpg thumnbnail image image3 size datestamp
> image4.jpg thumnbnail image image4 size datestamp
> image5.jpg thumnbnail image image5 size datestamp
>
> From php.net, I've found plenty of examples of how to create
> thumbnails from files and have done a couple successfully.
> My objective, however, is to have a page dynamically create
> multiple thumbnails from full sized images. I don't want to
> be creating and saving thumbnails to be used later.
>
> Possible? If so, then please just a pointer in the right direction.
>
> Thanks, Kevin
> --
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On Fri, 25 Mar 2005 21:32:44 -0500, Kevin Coyner <kevinrustybear.com> wrote:
>
> Is there a way to create multiple jpg thumbnails from a series of larger
> originals and use all of the on-the-fly generated thumbnails in a page
> (without saving any of the thumbnails to the filesystem)?
>
> For example, I've got 5 full size jpg's in a directory, and I'd like to
> list them on a page in table form as follows
>
> image1.jpg thumnbnail image image1 size datestamp
> image2.jpg thumnbnail image image2 size datestamp
> image3.jpg thumnbnail image image3 size datestamp
> image4.jpg thumnbnail image image4 size datestamp
> image5.jpg thumnbnail image image5 size datestamp
>
> From php.net, I've found plenty of examples of how to create thumbnails
> from files and have done a couple successfully. My objective, however,
> is to have a page dynamically create multiple thumbnails from full sized
> images. I don't want to be creating and saving thumbnails to be used
> later.
>
> Possible? If so, then please just a pointer in the right direction.
>
> Thanks, Kevin
> --

For performance reasons, when I an image is uploaded at my site, a
thumbnail is made right then and there. original goes into /images/
and the thumb goes into /images/tn/ with the exact same file name.
Then I link as:
<a href='/images/file.jpg'>
  <img src='/images/tn/file.jpg' alt='photo' border='0' />
</a>

Just my shtei agorot.

Dotan Cohen
http://Song-Lirics.com/
http://Song-Liriks.com/

attached mail follows:


Hello,

I cannot think of anyway you could do this natively in PHP without using
some kind of exterior library. You could always write a PHP extension to
render HTML, then create a snapshot from that, but that would be a lot
of work. I was searching around and found this,
http://www.babysimon.co.uk/khtml2png/index.html
you could use that, or even create a wrapper extension for it.

"Delos" <liberachehot.ee> wrote in message
news:20050324184122.61264.qmaillists.php.net...
> i would like to produce a script that can make an image ("screenshot")
> based only on the site url. so that i enter an URL and php makes the
> picture.
>
> can such a thing be done by php? if not, maybe by some other language?

--
Regards,
Matthew Fonda
http://www.mfonda.info

attached mail follows:


I have an if statement, and if it is true, I want PHP not to continue.

How do I do this?

The following statement is true

If ($a = $b){

This

}

Do not continue to the next piece of code, if false, continue to the next
piece of code.

Thanks for any help.

--
Steve Marquez
smarquezmarquez-design.com

attached mail follows:


* Marquez Design <smarquezmarquez-design.com>:
> I have an if statement, and if it is true, I want PHP not to continue.
>
> How do I do this?

if ($a == $b) {
        exit();
}

http://de3.php.net/exit

> The following statement is true
>
> If ($a = $b){

btw: Most of the times you will want to user == in an if-statement :)

Ciao,
  Gerhard

attached mail follows:


you could use die() or exit()
they both take an optional parameter of a string to display when called.

On Fri, 2005-03-25 at 20:12, Marquez Design wrote:
> I have an if statement, and if it is true, I want PHP not to continue.
>
> How do I do this?
>
> The following statement is true
>
> If ($a = $b){
>
> This
>
> }
>
> Do not continue to the next piece of code, if false, continue to the next
> piece of code.
>
> Thanks for any help.
>
> --
> Steve Marquez
smarquezmarquez-design.com
--
Regards,
Matthew Fonda
http://mfonda.info

attached mail follows:


I can't send email. Right?

attached mail follows:


On 20/03/2005, at 5:40 AM, Marek Kilimajer wrote:
>
> If you need only hotlink protection then the current referer checking
> is just enough. Most users will not install referer spoofing software.
>
> But if you need to be 100% sure the videos are streamed through
> affiliate server, you can use tokens - a script at the affiliate
> server will request a token from the streaming server (with
> username/password/clip id etc.). This token will be sent with the link
> to the streaming server. Hope this is clear.
>
>

Hi there sorry to return back to this, but we are somehow needing to
create a token url that will be generated on the customer's webpage
before the link is redirected to an access script of our clients video
feeds site. What would be the most safest credentials to use to create
a token with and how could the access script decrypt this information
to validate access ? Let me know if this is too vague of a question
thanks.

attached mail follows:


Hi everyone.

Im having a problem matcing some code using preg_match_all. The regex
statement needs to be very flexiable. The code im using is:

<project>(\n| |.)+<project>

to match the code. This code is being used to read project data is being
read from a socket and i need a way of spliting up the separate project
data. The regex above selects all the projects in one go down to the last
project statement. I guess instead of using the <project> tag (the start of
the next project). I need to match the </result> tag if the next line is
<project> or EOF. But im not sure how to do this. Does anyone have any
advice or help? Or have any sites that has a decent reference guide?

Thanks
Jamie

-==- Output from socket -==-
<project>
    <master_url>http://climateprediction.net/</master_url>
    <project_name>climateprediction.net</project_name>
    <user_name>Bob</user_name>
    <team_name></team_name>
    <email_hash>gr432this444has333been888changed</email_hash>
    <cross_project_id>FF035ggs5changedthisthis2sse25fb</cross_project_id>
    <user_total_credit>9640.785061</user_total_credit>
    <user_expavg_credit>28.001977</user_expavg_credit>
    <user_create_time>1093683684.000000</user_create_time>
    <rpc_seqno>132</rpc_seqno>
    <hostid>40622</hostid>
    <host_total_credit>9640.785061</host_total_credit>
    <host_expavg_credit>28.001976</host_expavg_credit>
    <host_create_time>1095354186.000000</host_create_time>
    <exp_avg_cpu>86400.000000</exp_avg_cpu>
    <exp_avg_mod_time>1105262213.578125</exp_avg_mod_time>
    <nrpc_failures>0</nrpc_failures>
    <master_fetch_failures>0</master_fetch_failures>
    <min_rpc_time>0.000000</min_rpc_time>
    <debt>1724.869789</debt>
    <resource_share>120.000000</resource_share>
</project>
<app>
    <name>hadsm3</name>
</app>
<app_version>
    <app_name>hadsm3</app_name>
    <version_num>404</version_num>
    <file_ref>
        <file_name>hadsm3_4.04_windows_intelx86.exe</file_name>
        <main_program/>
    </file_ref>
    <file_ref>
        <file_name>hadsm3data_4.04_windows_intelx86.zip</file_name>
        <open_name>hadsm3data_4.04_windows_intelx86.zip</open_name>
    </file_ref>
    <file_ref>
        <file_name>hadsm3se_4.04_windows_intelx86.zip</file_name>
        <open_name>hadsm3se_4.04_windows_intelx86.zip</open_name>
    </file_ref>
    <file_ref>
        <file_name>hadsm3um_4.04_windows_intelx86.zip</file_name>
        <open_name>hadsm3um_4.04_windows_intelx86.zip</open_name>
    </file_ref>
</app_version>
<workunit>
    <name>2uzw_000154831</name>
    <app_name>hadsm3</app_name>
    <version_num>404</version_num>
    <rsc_fpops_est>2461104000000000.000000</rsc_fpops_est>
    <rsc_fpops_bound>24611040000000000.000000</rsc_fpops_bound>
    <rsc_memory_bound>60000000.000000</rsc_memory_bound>
    <rsc_disk_bound>600000000.000000</rsc_disk_bound>
    <command_line>
2uzw_000154831
    </command_line>
    <file_ref>
        <file_name>2uzw_000154831.zip</file_name>
        <open_name>2uzw_000154831.zip</open_name>
    </file_ref>
</workunit>
<result>
    <name>2uzw_000154831_1</name>
    <wu_name>2uzw_000154831</wu_name>
    <project_url>http://climateprediction.net/</project_url>
    <final_cpu_time>1248051.515625</final_cpu_time>
    <exit_status>0</exit_status>
    <state>2</state>
    <report_deadline>1134868322.000000</report_deadline>
    <estimated_cpu_time_remaining>2623817.482888</estimated_cpu_time_remaining>
<active_task>
    <project_master_url>http://climateprediction.net/</project_master_url>
    <result_name>2uzw_000154831_1</result_name>
    <active_task_state>0</active_task_state>
    <app_version_num>404</app_version_num>
    <slot>0</slot>
    <scheduler_state>1</scheduler_state>
    <checkpoint_cpu_time>1248051.515625</checkpoint_cpu_time>
    <fraction_done>0.322363</fraction_done>
    <current_cpu_time>1248192.875000</current_cpu_time>
    <vm_bytes>0.000000</vm_bytes>
</active_task>
</result>
<project>
... next project details

attached mail follows:


http://bugs.php.net/bug.php?id=32449

I dont see how its not a bug.

attached mail follows:


Jay Blanchard wrote:
> [snip]
>
>> /* send the errors to the interface and exit*/
>> if('' !== $errorsReported){
>> for($i = 0; $i < count($errorsReported); $i++){
>> echo $errorsReported[$i];
>> }
>
> unset($errorsReported);
> print_r($errorsReported);
>
>> } else {
>> /* reload the empty interface */
>
>
> a quick echo statement here to check that this block is running when
> you expect it to might tell you something... but you have probably
> already plastered your code with echo/print statements to determine the
> flow :-)
> [/snip]
>
> Well, the array still appears, it is empty and unset (see modified code
> above) does not get rid of it. Here is how it comes back ....
> Array ( [0] => [1] => [2] => [3] => )

Well maybe its just me, but you are comparing an array with a string if
('' !== $errorsReported), which doesn't make any sense. Try this instead:

if (is_array($errorsReported))
{
    echo implode("",$errorsReported);
} else {
    header(....);
}

attached mail follows:


May be this help you:

$data=$_POST['position'];
$positions=array_keys($data);
foreach($positions as $pos){
    $row=$data[$pos];
    foreach($row as $value){
       $sql="INSERT INTO table_name (field_name)VALUES ('$value')";
       $cursor=mysql_query($sql);
    }
}

Devta.

virtualsoftwaregmail.com escribió:

>Hi,
>I have a form like this:
><form action="products.php" method="post">
><input name="position[pos][value 1]" type="text" id="position[pos][value 1]" value="number 1">
><input name="position[pos][value 2]" type="text" id="position[pos][value 2]" value="number 2">
><input name="position[pos][value 3]" type="text" id="position[pos][value 3]" value="number 3">
></form>
>
>For each element of the array i want to update the value in the database. For example, for position[pos][value 1] i want to update the value (number 1) in the database.
>
>Thanks in advance for your help!!!
>
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005
>
>