Open machomaaan opened 8 years ago
First of all you have to choose between: 1 https://www.impresspages.org/docs/form-object/file and 2 https://www.impresspages.org/docs/form-object/repositoryfile or 3 Any custom your own solution
First option is if you want users to upload files. But it is up to you how to handle files after the upload as they end up laced in tmp directoyr.
Second option is good if you want those images to be uploaded by the admin. But in this case you end up with files sitting in the repository (https://www.impresspages.org/docs/repository)
The third option is if you don't want to use any existing concepts and want to do your own file handling.
Hi Maskas, thanks for your answer. I'll use RepositoryFile but how can I display the uploaded image in frontend? Upload the image in Backend/Admin works, but how to display this file in frontend?
Thanks alot.
See Reflections part - https://www.impresspages.org/docs/repository
Hmm... I don't now how to use this?! Can you help me? I don't want to resize the images... just upload the image in backend with the form (AdminController.php) and than show the display in frontend (default.php).
So how I do the php echo?
Thank you very much.
Sure you can do so. RepositoryFile docs states an example code to get URL of submitted Repository File value:
<?php ipFileUrl('file/repository/' . $submittedValue);
I don't get the image :(
$field = new \Ip\Form\Field\RepositoryFile( array( 'name' => 'IMAGE', 'label' => 'IMAGE', 'preview' => 'thumbnails', 'value' => empty($widgetData['IMAGE']) ? null : $widgetData['IMAGE'], 'filterExtensions' => array('jpg', 'jpeg', 'png') ) );
The code you are using is just to make file upload to appear. How you save the submitted value and where do you display it are separate things.
Ok, so how can I submit the value an display it in default.php?
Can anybody tell me which code I've to write into AdminController.php and default.php for image upload and for file (pdf) upload? I can't manage that :(
Thank you very much.
Hi.
How can I add images an files to the Plugin "WidgetSkeleton"? I can add RichText, Text, and so on but i want to add an image with RepostoryFile. But the image doesn't appear in frontend.
So in WidgetSkeleton\AdminController.php I do this:
$field = new \Ip\Form\Field\RichText( array( 'name' => 'Description', 'label' => 'Description', 'value' => empty($widgetData['Description']) ? null : $widgetData['Description'] ) ); $form->addField($field);
And in WidgetSkeleton\Widget\WidgetSkeleton\Skin\default.php I do this:
So far so good. But how can I add an image and a file?
Thank you!