⚠ In case you've missed it we are migrating 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 forum is read-only and soon will be archived. ⚠


view image in read mode


  • Please log in to reply
5 replies to this topic

#1 jushadi

jushadi

    Newbie

  • Members
  • Pip
  • 3 posts

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

Attached Thumbnails

  • hadi_gc.png


#2 engr zardari

engr zardari

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 24 October 2013 - 02: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



#3 jushadi

jushadi

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 October 2013 - 10: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.



#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts

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!



#5 Donna111

Donna111

    Member

  • Members
  • PipPip
  • 10 posts

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.



#6 arronlee

arronlee

    Newbie

  • Members
  • Pip
  • 6 posts

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users