Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req: disable/revert the image preview due too heavy in huge data! #467

Open
mckaygerhard opened this issue Dec 12, 2018 · 7 comments
Open

Comments

@mckaygerhard
Copy link

option to able to disable the image preview! or at leas how to revert that feature available since 1.3

currently images are previewed in list and also in edit and new as per requested in:

https://www.grocerycrud.com/forums/topic/20-image-thumbnail-in-list-page/

that since 1.3.0, but now i want to revert this behavior! how can i do that!

@tyronelucero
Copy link

OH! is this possible to do?
I'm interested in this!

I have a web application with grocery crud but the internet in my country is getting slower, it would be great if instead of thumbnails I would show links ...

Any help please!

@mckaygerhard
Copy link
Author

thanks to @scoumbourdis as posted in a comment:

You can easily do that by changing the line 349 here: https://github.com/scoumbourdis/grocery-crud/blob/master/application/libraries/Grocery_CRUD.php#L349

More specifically change the line:
$file_url_anchor .= ' class="image-thumbnail"><img src="'.$file_url.'" height="50px">';
with:
$file_url_anchor .= ' class="image-thumbnail">' . $value;

and the line 2787: https://github.com/scoumbourdis/grocery-crud/blob/master/application/libraries/Grocery_CRUD.php#L2787

change the:
$input .= $is_image ? " $image_class'><img src='".$file_url."' height='50px'>" : "' target='_blank'>$value"
with:
$input .= "' target='_blank'>$value";

i'll try and maybe we can configure a config flag to disable previews!

vegnuli pushed a commit to venenux/simplegastos that referenced this issue Dec 24, 2018
…vy in huge data! Grocery_CRUD.php

* this alow to only list links in the LIST case of rendering.. 
* by this way loading of rendering a page in slow connections will able to run in remote cases
* later will be provided a patch to able to configure it in /scoumbourdis/grocery-crud/issues/467
@mckaygerhard
Copy link
Author

doit @scoumbourdis at codeigniterpower@45767c0 please i can make a patch for you repository but said if are able to pull that or i must change something?

mckaygerhard referenced this issue in codeigniterpower/codeigniter-grocerycrud Dec 24, 2018
* prepare configure keys at the configure file
* make the patch based on comments on oficial repository
* inicialize and chek the config variables also when will render fields
@scoumbourdis
Copy link
Owner

scoumbourdis commented Jan 14, 2019

Hello @mckaygerhard ,

Your approach is good and thanks for your code suggestion :) . I will try to find the time to review your code as I will need to do some changes from configurations point of view. I will keep you updated for any news

@mckaygerhard
Copy link
Author

if you need that i change something, just tell me.. that pacht are rude maybe.. works for now as preliminar support.. i cant made just now, but later i'll do more if you need to meet your code standart

@scoumbourdis
Copy link
Owner

scoumbourdis commented Jan 15, 2019

The code @mckaygerhard is fine. I was mainly thinking to have one configuration for the preview such as:

$config['grocery_crud_file_upload_image_preview'] = ['list', 'add', 'edit', 'view', 'clone'];

and at the code to use the in_array. For example:

$preview_file = $is_image && in_array('list', $this->config->grocery_crud_file_upload_image_preview);

for 4 main reasons:

  • It is easier to extend the configuration at the future to an already existing environment (e.g. no need to introduce new configuration all the time)
  • You can easier view where your preview is enabled or not
  • Less unnecessary lines at the config
  • We can also have it even more configurable to be able to disable it only on add or clone for example

What do you think?

@mckaygerhard
Copy link
Author

that's obvious .. you have right.. again sorry due in a hurry to easy do the coding i make separate configs options.. so as arrays are better, please if you plant to do something tellme ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants