PHP Classes

How to use?

Recommend this page to a friend!

      PHP Mosaic  >  All threads  >  How to use?  >  (Un) Subscribe thread alerts  
Subject:How to use?
Summary:Errors
Messages:17
Author:Jon Ezrin
Date:2009-06-30 23:55:19
Update:2010-04-22 03:09:04
 
  1 - 10   11 - 17  

  1. How to use?   Reply   Report abuse  
Picture of Jon Ezrin Jon Ezrin - 2009-06-30 23:55:19
All I get is errors both on localhost and webspace. Can you provide a better example?

  2. Re: How to use?   Reply   Report abuse  
Picture of johno dread johno dread - 2009-07-01 02:10:14 - In reply to message 1 from Jon Ezrin
Jon,

It would be nice to know the errors you are getting, that way I could give the correct solution.

However, some erors may arise if both scripts are on the same page and if the path to the pictures directory is not specified correctly.

Make sure to save the class and the example script in the same directory then point your browser to the example script. Hope this helps, please write again so we can solve this.

  3. Re: How to use?   Reply   Report abuse  
Picture of Jon Ezrin Jon Ezrin - 2009-07-01 02:46:47 - In reply to message 2 from johno dread
Sorry I wasn't more specific. Here are my errors:
Warning: imagesx(): supplied argument is not a valid Image resource in /home/xxx/public_html/test/Mosaic/Mosaic.php on line 65
Warning: imagesy(): supplied argument is not a valid Image resource in /home/xxx/public_html/test/Mosaic/Mosaic.php on line 66
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/xxx/public_html/test/Mosaic/Mosaic.php on line 68

The directory I am pointing to contains only jpg images and is listed as
/home/xxx/public_html/images/xxxx/

My webhost is running php5.

Thanks for the help.

  4. Re: How to use?   Reply   Report abuse  
Picture of johno dread johno dread - 2009-07-04 17:33:07 - In reply to message 3 from Jon Ezrin
Jon,

These messages shows the inability of the script to access the files. It could be that the location is not properly set or the file names do not end in ".JPG"

The solutions:
1.Place images in a directory that is accessible by the script. For example copy the image files from their current location and past them next to the Mosaic script. Open "Example script.php" and set
$dir = "/home/xxx/public_html/test/Mosaic";

2. Create new folder in "/home/xxx/public_html/test/Mosaic" and name it 'images' and place all images this new folder. Open "Example script.php" and set
$dir = "images";

3. You can also set $dir path to almost any other place on your computer using the "/path/to/images" syntax. For example to go folder outside the /home/ directory simply set
$dir = "/";

NOTE: images should have the ".JPG" extension.

  5. Re: How to use?   Reply   Report abuse  
Picture of Jon Ezrin Jon Ezrin - 2009-07-04 18:27:37 - In reply to message 4 from johno dread
I did exactly as you suggested in your solutions 1 and 2. Here is an example of my current errors:

Warning: imagecreatefromjpeg(Purple_Finches.JPG) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/xxxx/public_html/test/Mosaic/Mosaic.php on line 48

Perhaps a problem with the php configuration?

The above error is repeated for each image in the directory and then the other errors I shared previously are generated. The error_log continues to grow until I stop the script and becomes a megabyte or more in seconds even though there are only 3 images in the directory.

Thanks for your efforts.

  6. Re: How to use?   Reply   Report abuse  
Picture of davedee davedee - 2010-04-20 07:01:35 - In reply to message 5 from Jon Ezrin
I also have this exact problem, was it ever resolved?

  7. Re: How to use?   Reply   Report abuse  
Picture of Jon Ezrin Jon Ezrin - 2010-04-20 10:51:38 - In reply to message 6 from davedee
No, it was never resolve for me.

  8. Re: How to use?   Reply   Report abuse  
Picture of johno dread johno dread - 2010-04-20 11:50:32 - In reply to message 5 from Jon Ezrin
Jon Ezrin,

Bases on the error the preoblem I see is that the file type is incorrect.

This class is dependent on a function called imagecreatefromjpeg.

and in my experience it will only process images with JPEG or jpeg extentions: in this case it the class expects JPEG as the image extention.

You coulg look in the script for the string "JPEG" and change it to "jpeg"

If you are not sure what images are in you directory, go to images.google.com and upload a few jpeg images then test it again

  9. Re: How to use?   Reply   Report abuse  
Picture of davedee davedee - 2010-04-21 01:14:43 - In reply to message 8 from johno dread
Hi Johno

Thanks for the prompt reply, I tried changing ext to JPEG and jpeg still the same errors as above, also tried folder suggestions as in reply above. any thoughts on what else i could try, this would be a great script for me if i could get it going, thanks again for your time.

  10. Re: How to use?   Reply   Report abuse  
Picture of johno dread johno dread - 2010-04-21 03:21:50 - In reply to message 9 from davedee
davdee,

Go to the main class and replace the line:

if(preg_match("/[.]JPEG$/",$file) && $file != $this->outfile)

with:

if(preg_match("/[.]jpg|jpeg|JPEG$/",$file) && $file != $this->outfile)

and let me know

 
  1 - 10   11 - 17