[TYPO3-project-formidable] Image Preview in Editform

JéŽrô™me Schneider j.schneider at ameos.com
Mon Jan 18 16:05:04 CET 2010


Hi Markus and pablo,
I used both your indications and I produced this example.
http://formidable.typo3.ug/pastebin/snippet/109.html

You'll find a working demo here:
http://formidable.typo3.ug/tutorials/image-upload-preview-deletion.html

I hope this will make it.
Jerome.


Le 12/01/10 18:59, Markus Lange a écrit :
> Hi Pablo
>
> thank you for your anwser!
>
>> And about adding a delete button for each photo, try embedding the
>> code in a renderlet:LISTER.
>
> Unfortunaltely this did not worked for me.
>
> To delete a pic in editmode i figured out the code below and it works
> pretty well.
> i have to update the record and repaint the form
> they might be better ways (but its first time i use formidable and iam
> quite impressed!!)
>
> best regards
> Markus
>
>
>
> <renderlet:BUTTON name="image_delete5" style="width:100px;">
> <label>Bild löschen</label>
> <onclick runat="ajax" params="uid">
> <userobj>
> <php><![CDATA[
> $formData = $this->oDataHandler->getFormData();
> $iImage = $formData['image5'];
> $iUid = $this->oDataHandler->_currentEntryId();
> $oFileTool = t3lib_div::makeInstance("t3lib_basicFileFunctions");
> $sTargetDir = 'uploads/tx_kundenideen/';
> $sTargetDir = t3lib_div::fixWindowsFilePath(
> $oFileTool->slashPath($oFileTool->rmDoubleSlash($sTargetDir)));
> $sPath = $sTargetDir.$iImage;
> $sPath = tx_ameosformidable::toRelPath($sPath);
> if(file_exists($sPath) && is_dir($sPath) && ($sPath{(strlen($sPath) -
> 1)} !== "/")) {
> $sPath .= "/";
> }
> $sPath =
> tx_ameosformidable::_removeEndingSlash(t3lib_div::getIndpEnv("TYPO3_DOCUMENT_ROOT"))
> . "/" . tx_ameosformidable::_removeStartingSlash($sPath);
> unlink($sPath)
>
> if($iUid) {
> $fields = array();
> $fields['image5']='';
> $GLOBALS["TYPO3_DB"]->exec_UPDATEquery( "tx_kundenideen_ideen", "uid='"
> . $iUid . "'",$fields );
> }
> return $this->majixRequestEdition($iUid);
> ]]></php>
> </userobj>
> </onclick>
> </renderlet:BUTTON>



More information about the TYPO3-project-formidable mailing list