Advertisement:

Author Topic: Image Error after Update  (Read 6361 times)

zawadi

  • Newbie
  • *
  • Posts: 25
Image Error after Update
« on: March 01, 2013, 12:57:15 am »
Hello
 (Current version 310)
I updated my website without any issues automatic. The issue that I am having is that I cannot create a listing with an image anymore.
This is the error that I am getting.
After the update is there something else that I am supposed to edit in the fil permissions? Do the file permissions change once you update automatic without doing it manual? I posted an image here of the error. The only thing I whiteout is my website path and ftp name ( which is not causing the issues ).
I wanted to finally put my website online this week and this is the only thing that is setting me back.
Thanks in advance
« Last Edit: March 01, 2013, 01:00:36 am by zawadi »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Image Error after Update
« Reply #1 on: March 01, 2013, 03:30:24 pm »
Hi. Same here.

After doing some tests, I've found there is some problem related to ImageMagick. Here is what the PHP error log reports:

Quote
[01-Mar-2013 11:54:22 UTC] PHP Fatal error:  Uncaught exception 'ImagickException' with message 'no encode delegate for this image format `/tmp/phpqeTK6d_normal' @ error/constitute.c/WriteImage/1188' in /my_osclass_site/oc-includes/osclass/classes/ImageResizer.php:100
Stack trace:
#0 /my_osclass_site/oc-includes/osclass/classes/ImageResizer.php(100): Imagick->writeimage('/tmp/phpqeTK6d_...')
#1 /my_osclass_site/oc-includes/osclass/ItemActions.php(1293): ImageResizer->saveToFile('/tmp/phpqeTK6d_...')
#2 /my_osclass_site/oc-includes/osclass/ItemActions.php(201): ItemActions->uploadItemResources(Array, 14)
#3 /my_osclass_site/oc-includes/osclass/controller/item.php(151): ItemActions->add()
#4 /my_osclass_site/index.php(95): CWebItem->doModel()
#5 {main}
  thrown in /my_osclass_site/oc-includes/osclass/classes/ImageResizer.php on line 100

Unchecking "Use ImageMagick instead of GD library" in Settings / Media seems to solve the problem.

I'm pretty new with Osclass, it's my first post here, so thank you so much for this nice software. Keep up the good work  :)

zawadi

  • Newbie
  • *
  • Posts: 25
Re: Image Error after Update
« Reply #2 on: March 01, 2013, 07:09:00 pm »
Hi Thanks for response, I will go and run to my site and see what happens  8)  Thanks again


.. ok it worked perfectly, u are a genius :)


Zawadi
« Last Edit: March 01, 2013, 07:11:05 pm by zawadi »

gorilla

  • Newbie
  • *
  • Posts: 37
Re: Image Error after Update
« Reply #3 on: March 01, 2013, 08:49:00 pm »
hello good day , same error here cannot post with image in osclass 3.1 already uncheck "use image magic" post picture size only 38 kb, upload permision setting in 755.. stil cannot upload image both user and admin

anyone can help?

thx

painperdu

  • Newbie
  • *
  • Posts: 26
Re: Image Error after Update
« Reply #4 on: March 26, 2013, 10:47:07 pm »
I get this error too so I switched to GD and it seems to be working fine.

gorilla

  • Newbie
  • *
  • Posts: 37
Re: Image Error after Update
« Reply #5 on: March 27, 2013, 05:57:33 pm »
after new install osclass 3.1.1 march 20 no image problem coming...just try isntall osclass 3.1.1

Anti-NWO

  • Newbie
  • *
  • Posts: 38
Re: Image Error after Update
« Reply #6 on: April 09, 2013, 02:29:59 am »
I am also experiencing this problem after installing 3.1.1.

Please help...!
http://spotpricemetals.com

Thanks,

Tom

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: Image Error after Update
« Reply #7 on: April 14, 2013, 12:19:12 pm »
I replaced new imagick code with the old one and it fixes the problem temporarily. I hope in next version they will fix that.

dfwdogs

  • Newbie
  • *
  • Posts: 4
Re: Image Error after Update
« Reply #8 on: April 14, 2013, 07:38:30 pm »
I replaced new imagick code with the old one and it fixes the problem temporarily. I hope in next version they will fix that.

Can you share with everyone the code that you changed? I don't have access to an older version of osclass.

navjottomer

  • Tutor
  • Sr. Member
  • *
  • Posts: 373
  • I am here
Re: Image Error after Update
« Reply #9 on: April 14, 2013, 08:40:19 pm »
I changed this whole functions in itemactions.php

Code: [Select]
public function uploadItemResources($aResources,$itemId) {
............................................
.........................................
........................................
              unset($itemResourceManager);
            }
            return 0; // NO PROBLEMS
        }

To this one
Code: [Select]
public function uploadItemResources($aResources,$itemId)
        {
            if($aResources != '') {
                $wat = new Watermark();

                $itemResourceManager = ItemResource::newInstance() ;

                $numImagesItems = osc_max_images_per_item();
                $numImages = $itemResourceManager->countResources($itemId);
                foreach ($aResources['error'] as $key => $error) {
                    if($numImagesItems==0 || ($numImagesItems>0 && $numImages<$numImagesItems)) {
                        if ($error == UPLOAD_ERR_OK) {

                            $numImages++;

                            $tmpName = $aResources['tmp_name'][$key] ;
                            $itemResourceManager->insert(array(
                                'fk_i_item_id' => $itemId
                            )) ;
                            $resourceId = $itemResourceManager->dao->insertedId();

                            // Create normal size
                            $normal_path = $path = osc_content_path() . 'uploads/' . $resourceId . '.jpg' ;
                            $size = explode('x', osc_normal_dimensions()) ;
                            ImageResizer::fromFile($tmpName)->resizeTo($size[0], $size[1])->saveToFile($path) ;

                            if( osc_is_watermark_text() ) {
                                $wat->doWatermarkText( $path , osc_watermark_text_color(), osc_watermark_text() , 'image/jpeg' );
                            } elseif ( osc_is_watermark_image() ){
                                $wat->doWatermarkImage( $path, 'image/jpeg');
                            }

                            // Create preview
                            $path = osc_content_path(). 'uploads/' . $resourceId . '_preview.jpg' ;
                            $size = explode('x', osc_preview_dimensions()) ;
                            ImageResizer::fromFile($normal_path)->resizeTo($size[0], $size[1])->saveToFile($path) ;

                            // Create thumbnail
                            $path = osc_content_path(). 'uploads/' . $resourceId . '_thumbnail.jpg' ;
                            $size = explode('x', osc_thumbnail_dimensions()) ;
                            ImageResizer::fromFile($normal_path)->resizeTo($size[0], $size[1])->saveToFile($path) ;

                            if( osc_keep_original_image() ) {
                                $path = osc_content_path() . 'uploads/' . $resourceId.'_original.jpg' ;
                                move_uploaded_file($tmpName, $path) ;
                            }

                            $s_path = 'oc-content/uploads/' ;
                            $resourceType = 'image/jpeg' ;
                            $itemResourceManager->update(
                                                    array(
                                                        's_path'            => $s_path
                                                        ,'s_name'           => osc_genRandomPassword()
                                                        ,'s_extension'      => 'jpg'
                                                        ,'s_content_type'   => $resourceType
                                                    )
                                                    ,array(
                                                        'pk_i_id'       => $resourceId
                                                        ,'fk_i_item_id' => $itemId
                                                    )
                            ) ;
                            osc_run_hook('uploaded_file', ItemResource::newInstance()->findByPrimaryKey($resourceId));
                        }
                    }
                }
                unset($itemResourceManager);
            }
        }

I thinks this is the only change i have made, If didn't forget something!!!
Sorry i spell imagick code instead of this change.

Regards

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4691
Re: Image Error after Update
« Reply #10 on: April 15, 2013, 03:20:19 pm »
Hi

This change should fix the issue, no need to use the old code in itemActions.php

https://github.com/osclass/Osclass/commit/72bc5b88737a0665a89688da682a11192ae804e7

Just add the line
Code: [Select]
$this->im->setImageFormat('jpeg');in oc-includes/osclass/classes/ImageResizer.php

Vindex

  • Newbie
  • *
  • Posts: 1
Re: Image Error after Update
« Reply #11 on: May 25, 2013, 01:56:48 am »
just to say, thank you navjottomer
your solution solve my upload problem  :)



onaldo

  • Jr. Member
  • **
  • Posts: 75
Re: Image Error after Update
« Reply #12 on: May 31, 2014, 10:07:36 am »
Here exactly should I insert this code?


Hi

This change should fix the issue, no need to use the old code in itemActions.php

https://github.com/osclass/Osclass/commit/72bc5b88737a0665a89688da682a11192ae804e7

Just add the line
Code: [Select]
$this->im->setImageFormat('jpeg');in oc-includes/osclass/classes/ImageResizer.php

kets999

  • Newbie
  • *
  • Posts: 4
Re: Urgent Help Required
« Reply #13 on: June 05, 2018, 01:42:12 am »
Hi

I need your urgent help....Please

I want home page style display (displaying all the categories) on click of any regions and displaying homepage categories and number of ads for specific regions like

when birmingham is selected it shows page as follows:
https://birmingham.craigslist.co.uk/

if oxford  is selected, it shows :
https://oxford.craigslist.co.uk/

please can you help.

Many Thanks

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 1972
  • osclass.work
Re: Image Error after Update
« Reply #14 on: June 05, 2018, 03:25:08 am »
kets999, can I ask why are you bringing old and unrelated topic to post about your requirements? This topic has nothing to do with themes customization. You already have 2 posts about this somewhere, please don't spam.