⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

view image in read mode



jushadi
  • profile picture
  • Member

Posted 24 October 2013 - 02:13 AM

I'm fairly new to grocerycrud

I'm using stable version 1.4.1

 

I notice in list and edit mode, there is a thumbnail for uploaded image, but just a link in view/read mode for files or image

so I guess I need to edit some code in grocerycrud library

 

I change this line

    protected function get_upload_file_readonly_input($field_info,$value)
    {
        $file = $file_url = base_url().$field_info->extras->upload_path.'/'.$value;

        $value = !empty($value) ? '<a href="'.$file.'" target="_blank">'.$value.'</a>' : '';

        return $this->get_readonly_input($field_info, $value);
    }

to this

	protected function get_upload_file_readonly_input($field_info,$value)
	{
		$file = $file_url = base_url().$field_info->extras->upload_path.'/'.$value;

			if(empty($value))
				{
					$value = "";
				}
				else
				{
					$is_image = !empty($value) &&
					( substr($value,-4) == '.jpg'
							|| substr($value,-4) == '.png'
							|| substr($value,-5) == '.jpeg'
							|| substr($value,-4) == '.gif'
							|| substr($value,-5) == '.tiff')
							? true : false;

					$file_url = base_url().$field_info->extras->upload_path."/$value";

					$file_url_anchor = '<a href="'.$file_url.'"';
					if($is_image)
					{
						$file_url_anchor .= ' class="image-thumbnail"><img src="'.$file_url.'" height="150px">';
					}
					else
					{
						$file_url_anchor .= ' target="_blank">'.$this->character_limiter($value,$this->character_limiter,'...',true);
					}
					$file_url_anchor .= '</a>';

					$value = $file_url_anchor;
				}
    return $this->get_readonly_input($field_info, $value);
    }

sorry if my English is hard to understand


engr zardari
  • profile picture
  • Member

Posted 24 October 2013 - 14:24 PM

sorry actually i can not get your question...and please if you are uploading a snapshot of your problem than please mark it with any color so we can get the actual problem..

 

thanks


jushadi
  • profile picture
  • Member

Posted 24 October 2013 - 22:44 PM

sorry, my bad. I think my explanation is not clear enough. actually I want to share how to show image thumbnail instead just link of the picture in read/view page. (you could try to upload image, it will show thumbnail when you add or edit and also in list page, but none in read/view page). so I made a little change above,)

 

thanks for reply anyway.


davidoster
  • profile picture
  • Member

Posted 10 November 2013 - 06:09 AM

sorry, my bad. I think my explanation is not clear enough. actually I want to share how to show image thumbnail instead just link of the picture in read/view page. (you could try to upload image, it will show thumbnail when you add or edit and also in list page, but none in read/view page). so I made a little change above,)

 

thanks for reply anyway.

Well this is a good idea! I haven't checked your code but you could help out the development of the GC library by posting this to github!


Donna111
  • profile picture
  • Member

Posted 09 December 2013 - 03:12 AM

Hi there

For me ,it is a little bit difficult for me to view the image using a code.I want to get an powerful image program which supports to view image or processing image effectively.I know there are many image viewer .But i

want to get a free trial package to have a try before i decided to purchase it.Thanks for any suggestion.


arronlee
  • profile picture
  • Member

Posted 22 January 2014 - 02:36 AM

Yup indeed, I agree with Donna111.

You can learn to build a 3rd party image web viewer or windows viewer to help you view image in read mode, using some manual image tools which can be customized by users according to our own favors

. Google it and selsct one to have a try. I hope you success. Good luck.

 

 

 

Best regards,

Arron