New to PHP - Photo Gallery

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
jamkelvl
Forum Newbie
Posts: 9
Joined: Thu Jun 25, 2009 3:23 pm

New to PHP - Photo Gallery

Post by jamkelvl »

Hey

Here is my explanation of what I want to do, this is as simple as it gets. Actually, it can be even more simple..

- Search a directory of images

- Resize images to 600px wide (Can PHP actually resize the file or does it just shrink it for the browser?)

- Display the images

There is a lot more to this that I want to do but i'm leaving all of that out.

My main concern is I'm sick of manually resizing images and manually creating thumbs and I want to know if PHP can do this for me?

My first step would be to just iterate thru the a directory checking or even getting the image sizes for starters...

I have some code already but the getimagesize function isn't working for me I get this error: Warning: getimagesize(/newsite/impact/HPIM1816 thumb.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /mnt/w0002/d13/s02/b02d93c5/www/newsite/news.php on line 72

Any help?
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: New to PHP - Photo Gallery

Post by akuji36 »

try this link:

http://www.bitrepository.com/resize-an- ... nd-gd.html

This link refers to php GD Library class.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: New to PHP - Photo Gallery

Post by pickle »

The reason getimagesize() isn't working for you is hinted in the error. You're asking for "/newsite/impact/HPIM1816 thumb.jpg", but I think you forgot to add the document root to that. Try running getimagesize() on "/mnt/w0002/d13/s02/b02d93c5/www/newsite/impact/HPIM1816 thumb.jpg" and it should work.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply