Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

silverstripe 2.4 upgrade problem


Reply

7 Posts   1393 Views

Avatar
SSadmin

25 May 2010 at 2:45pm Community Member, 90 Posts

Hey, guys. i met a very strange problem with 2.4 ImageField.
I upgraded a site from 2.3.6 to 2.4, imported the whole database and copy the whole assest folder.
Then, the problem came out.
It happnes on ImageField-[Replace Image], if you click the radio button [from the File Store] and select any image from the local file store and click the[replace]. This image will not be found in File Store anymore. I dont know why it act like this.
The imge is there on the asset folder but just cannot see in File Store through the ImageField anymore....
Anyone knows the solution to the problem?!
Thanks in advanced..

Avatar
SSadmin

25 May 2010 at 3:55pm Community Member, 90 Posts

Stop spaming Zatarsales04.... this doesnt help at all.

Avatar
SSadmin

25 May 2010 at 5:08pm Community Member, 90 Posts

i was doing heaps of testing on this problem. and also simulated a similar enviroment to make sure that wont have the same problem.

I have found the 2.4 verison has the problem. The eariler versions are good..

The new discovery was found :

It will be fine if i use:

   public static $has_one=array(
   'HomePageImage'=>'Image',
   'HomeImage'=>'Image'
   );

Directly refer the Generic Image Class.

but will be problem if i use MyImage class extends Image Class
So,if i do something like
public static $has_one=array(
   'HomePageImage'=>'MyImage',
   'HomeImage'=>'MyImage'
   );
This problem happens.

For your interests, the code in my MyImage Class is :

<?php
class MyImage extends Image{
   
   public   function generateHomeProductImage($gd) {
      $gd->setQuality(100);
      return $gd->croppedResize(285,150);
      }   
      
   public   function generateHomeSpotLightImage($gd)
         {
                  $gd->setQuality(100);
    return $gd->croppedResize(485,212);
         }   
            
   
}

?>

Anyone know whats going on here?!
Thanks...

Avatar
SSadmin

28 May 2010 at 3:22pm Community Member, 90 Posts

I have encounterred lots of problem in ImageFiled and Image.php file.

I am not sure is there anything changes on 2.4. it seems the Image class cannot be extended to be customized(MyImage) anymore. It will always bring lots of problems when i was using MyImage to extend Image and adding the croppedresize function for MyImage.

I have also noticed the tutorial has been updated about the ImageField @ "recipes/imageupload.txt • Last modified: 2010/05/05 23:38 "

However, it doesn't mention the CustomizedImage can be applied to extend the Base Image Class as a another .php file in the mysite folder.

It seems the silverstripe team encourage developer to separate the corppedresize function into the /mysite/xxxx.php code after Page_Controller instead.

Not sure what’s going on THIS area. But really knee to know whether is anything wrong with my code or the traditional routine cannot be applied anymore?!

Alex

Avatar
keeny

12 June 2010 at 1:38am Community Member, 48 Posts

Hi there Alex.

There's a filter in the TreeDropdownField that only displays objects of type 'Folder' or 'Image'.

This patch: [url]http://open.silverstripe.org/ticket/5708[/url] will also display any objects that are a subclass of 'Image'.

Keep the faith,

Barry :-P

Avatar
SSadmin

12 June 2010 at 11:51pm Community Member, 90 Posts

Hey.Barry.
Thanks for the ticket, seems we met the same problem with using the same image class to dealing with ImageField problem.
Thanks for pointing out the the filter can only filter "Image" class.
Everything extends Image cannot be found out using ImageField (upload from file store).
Keep the status up.
Would like to see solution soon.

We need to catch up in real life.

Regards.
Alex

Avatar
pinkp

14 June 2010 at 9:29pm Community Member, 168 Posts

Good patch many thanks!
Really helped me as the image did not appear in ImageGallery "Replace Image > From the File Store" only folders.