⚠ 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

image crud



maha
  • profile picture
  • Member

Posted 28 January 2013 - 10:12 AM

I want a watermark imge for my imges so i used image_moo liberary
but it doesn't work

my code is

function management()
{

$crud = new grocery_CRUD();
$crud->set_table('photos');
$crud->set_field_upload('Image', 'assets/uploads/');
$crud->callback_after_upload(array($this,'example_callback_after_upload'));
$output = $crud->render();
$this->_output_data($output);
}
function example_callback_after_upload($uploader_response,$field_info, $files_to_upload)
{

$this->load->library('image_moo');

//Is only one file uploaded so it ok to use it with $uploader_response[0].
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
$this->image_moo
->load('$file_uploaded')
->make_watermark_text("MatMoo.com", "Midan_4.ttf", 25, "#00ff00")
->resize(400,400)
->watermark(2)
->save($file_uploaded,true);//save_dynamic();


return true;
}


but nothing happend
please help!

victor
  • profile picture
  • Member

Posted 28 January 2013 - 14:06 PM

->load('$file_uploaded') what is it?
I about '$file_uploaded'.

try this:
->load($file_uploaded)

maha
  • profile picture
  • Member

Posted 29 January 2013 - 12:51 PM

[quote name='victor' timestamp='1359381976' post='5322']
->load('$file_uploaded') what is it?
I about '$file_uploaded'.

try this:
->load($file_uploaded)
[/quote]
what is the differance?

$file_uploaded is the sorce image.

victor
  • profile picture
  • Member

Posted 29 January 2013 - 13:36 PM

[quote name='maha' timestamp='1359463889' post='5338']
what is the differance?
[/quote]

$s = "example";
echo '$s.'; // $s.
echo "$s."; // example

don't use quotes: ->load($file_uploaded)

maha
  • profile picture
  • Member

Posted 29 January 2013 - 13:44 PM

i tried it it doesn't work
and the image uploaded twice

victor
  • profile picture
  • Member

Posted 29 January 2013 - 13:54 PM

I use another class for those things.

http://www.verot.net...oad_samples.htm
this class works slowly but has many settings

maha
  • profile picture
  • Member

Posted 29 January 2013 - 14:00 PM

i will try it thank you very much

victor
  • profile picture
  • Member

Posted 29 January 2013 - 14:07 PM

Maybe the class needs to be modified a bit. I don't remember.

davidoster
  • profile picture
  • Member

Posted 30 January 2013 - 09:15 AM

Maybe the ttf can't be found on this line,
[color=#666600][size=2]->[/size][/color][color=#000000][size=2]make_watermark_text[/size][/color][color=#666600][size=2]([/size][/color][color=#008800][size=2]"MatMoo.com"[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] [/size][/color][color=#008800][size=2]"Midan_4.ttf"[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] [/size][/color][color=#006666][size=2]25[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] [/size][/color][color=#008800][size=2]"#00ff00"[/size][/color][color=#666600][size=2])[/size][/color]
Make sure you provide the full path to the font!

victor
  • profile picture
  • Member

Posted 30 January 2013 - 19:24 PM

Yes, I think David Oster is right