This is a discussion on image of the week type script? within the PHP Language forums, part of the PHP Programming Forums category; hi there i need a site where the client can upload an image every week, with a caption, (so pref ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
hi there
i need a site where the client can upload an image every week, with a caption, (so pref use the php upload image function to provide a web based interface) and that then automatically publishes and becomes the image of the week, and all previous weeks images become smaller thumbnails below.... anybody have an idea of how to do this? or is there a predesigned script i could use? thanks |
|
|||
|
1 wrote:
> hi there > i need a site where the client can upload an image every week, with a > caption, (so pref use the php upload image function to provide a web based > interface) > and that then automatically publishes and becomes the image of the week, and > all previous weeks images become smaller thumbnails below.... anybody have > an idea of how to do this? or is there a predesigned script i could use? > thanks This should be fairly easy... Create your form that will upload the image and store the caption in a file (single line append). When saving the file, generate both the thumbnail and large versions of the image (use GD or ImageMagick to resize accordingly). Save the image as a JPEG with a file name as a timestamp (http://www.php.net/time). (Then you'll have image names like "1091546757.jpg" Append the caption to a single line of the file. Now for the front end of things... Grab all the file names from the directory (http://www.php.net/readdir) into an array and sort them according to filename. (Watch for the "." and ".." entries, you won't want those.) Read in the captions (http://www.php.net/file), which will already be sorted by date. Flip both arrays, output element 0 of each for the pic of the week. The rest in the array would be previous images... -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended. |
|
|||
|
Justin Koivisto wrote:
> Append the caption to a single line of the file. Sorry, forgot the reference... http://www.php.net/fopen & http://www.php.net/fwrite -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended. |
|
|||
|
the archive will be ongoing - i.e. no upper limit...
"Margaret MacDonald" <scratch65536@att.not.invalid> wrote in message news:9obvg05sc1ietus4ba9fdtrfj34qfj9e8a@4ax.com... > Sorry, I see now that I didn't read your posting all the way through, > so while my suggestion will handle the current image, it does nothing > about relegating previous images. > > Is there any upper bound on the number of stale images to be > relegated? > > I wrote: > > >1 wrote: > > > >>hi there > >>i need a site where the client can upload an image every week, with a > >>caption, (so pref use the php upload image function to provide a web based > >>interface) > >>and that then automatically publishes and becomes the image of the week, and > >>all previous weeks images become smaller thumbnails below.... anybody have > >>an idea of how to do this? or is there a predesigned script i could use? > >>thanks > >> > >> > > > >Is there a reason why something simple like this wouldn't work? > ><?php > >echo > >'<table> > > <tr> > > <td> > > <img src="url_of_image" ><br>' ; > >include( 'url_of_caption' ) ; > >echo > >' </td> > > </tr> > ></table>' ; > > > >Margaret > > -- > (To mail me, please change .not.invalid to .net, first. > Apologies for the inconvenience.) |
|
|||
|
cheers justin
btw you dont have a source for any code that is similar do you? my php skills are basic to say the least, "Justin Koivisto" <spam@koivi.com> wrote in message news:cdOPc.25$j1.974@news7.onvoy.net... > Justin Koivisto wrote: > > > Append the caption to a single line of the file. > > Sorry, forgot the reference... http://www.php.net/fopen & > http://www.php.net/fwrite > > -- > Justin Koivisto - spam@koivi.com > PHP POSTERS: Please use comp.lang.php for PHP related questions, > alt.php* groups are not recommended. |
|
|||
|
I noticed that Message-ID: <lbOPc.24$j1.974@news7.onvoy.net> from Justin
Koivisto contained the following: >Create your form that will upload the image and store the caption in a >file (single line append). I'd store all the stuff about the image in a database table( image URL thumb URL, Image caption, thumb caption, alt text, date created etc. This is more flexible as it allows you to add extra information (photographer, location, model name, agency...) at a later date, if need be. The data can also be used for other things. Fetch the data with an ordered query and the first record will be pic of the week. It stays till you upload a new one. -- Geoff Berrow (put thecat out to email) It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |
|
|||
|
1 wrote:
> the archive will be ongoing - i.e. no upper limit... So you are happy that in three years' time, the page will have over 150 images on it? -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact Now Playing ~ ./manic_street_preachers/you_stole_the_sun_from_my_heart.ogg |
|
|||
|
1 wrote:
> > "Justin Koivisto" <spam@koivi.com> wrote in message > news:cdOPc.25$j1.974@news7.onvoy.net... > >>Justin Koivisto wrote: >> >> >>>Append the caption to a single line of the file. >> >>Sorry, forgot the reference... http://www.php.net/fopen & >>http://www.php.net/fwrite >> > cheers justin > btw you dont have a source for any code that is similar do you? > my php skills are basic to say the least, Sure, for the image part of it anyway: http://www.koivi.com/php-gd-image-watermark/ -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended. |
|
|||
|
Geoff Berrow wrote:
> I noticed that Message-ID: <lbOPc.24$j1.974@news7.onvoy.net> from Justin > Koivisto contained the following: > > >>Create your form that will upload the image and store the caption in a >>file (single line append). > > > I'd store all the stuff about the image in a database table( image URL > thumb URL, Image caption, thumb caption, alt text, date created etc. > This is more flexible as it allows you to add extra information > (photographer, location, model name, agency...) at a later date, if need > be. The data can also be used for other things. > > Fetch the data with an ordered query and the first record will be pic of > the week. It stays till you upload a new one. I would as well, but the OP had said something about mysql being overkill in an earlier thread today... ;) -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended. |
|
|||
|
"Toby Inkster" <usenet200408@tobyinkster.co.uk> wrote in message
news:pan.2004.08.03.17.30.49.424676@tobyinkster.co .uk... > 1 wrote: > > > the archive will be ongoing - i.e. no upper limit... > > So you are happy that in three years' time, the page will have over 150 > images on it? > > -- > Toby A Inkster BSc (Hons) ARCS > Contact Me ~ http://tobyinkster.co.uk/contact > Now Playing ~ ./manic_street_preachers/you_stole_the_sun_from_my_heart.ogg we'll worry about that in 3 years time! |