[TYPO3] frontend jm_gallery captions instead of file name

dave typo typothree at gmail.com
Fri Nov 3 15:54:37 CET 2006


Hi (long time archive-scourer, first time poster) ;)

I'm looking to extend the capabilities of the jm_gallery extension.

Specifically, I am looking to force a user into entering a caption for the
image he or she is uploading to the server.

by default, image filenames are what comprise the captions, and in order for
captions to exist, they must be entered through the backend.

Could someone help me figure out how to make the admin upload require one to
fill out a field that changes the caption option?

Anyway, I've been trying to see a pattern through the php code, specifically
in the class.tx_jmgallery_controller_Admin.php file and the
class.tx_jmgallery_view_Admin.php files to see a way of adding this
component to the extension. However, I have limited php abilities, and while
I understand -generally- how the files relate to each other, I have no idea
where to start.

I think that I should alter code within these parts of the
class.tx_jmgallery_controller_Admin.php file:

/* check if there's already a record for this file */
                        $image =
tx_jmgallery_model_Image::getImageForFilename($filename, $album);

                        if ($image === NULL) {
                            $image = new tx_jmgallery_model_Image();
                            $image->caption =
$filename;                           //  <------ specifcally altering this
so that the caption is not derrived from the filename
                            $image->filename = $filename;
                            $image->views = 0;
                            $image->album = $album;
                            $image->setConfiguration($this->conf);
                            $size =
getimagesize($album->getDirectory()."/".$filename);
                            $this->xResolution = $size[0];
                            $this->yResolution = $size[1];
                            $image->create();
                        }


/* as well as this, also under the controller file: */

if ($image !== NULL) return;
                        else {
                            $image = new tx_jmgallery_model_Image();
                            $image->setAlbum($album);

$image->setFilename($_FILES[$this->prefixId]["name"]["filename"]);

$image->setCaption($_FILES[$this->prefixId]["name"]["filename"]);
// since the caption is set to obtain the filename.
                            $image->setConfiguration($this->conf);
                        }


So,


could someone help explain what code needs to be written for the admin php
files in order to create a form that allows users to enter captions for the
jm_gallery extension?

if you need more information, please reply. Any help is appreciated.

thank you in advance.


-Dave

p.s. if there is another extension that allows front end uploads and
user-specific captioning, let me know. goof fotoboek, the photoblog
extenson, and the photographic library extensions all seemed to be more
limited for my needs. But, if there is another anyone can recommend, let me
know

Thanks again.

:)



More information about the TYPO3-english mailing list