Code Monkey home page Code Monkey logo

Comments (10)

hacfi avatar hacfi commented on July 28, 2024

@xleliberty How do you set the image or how does your code look like?

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

HiThere is no extra code ...

I only use the défaut imagineBlock form...

Xavier Lembo

On Sat, Jul 19, 2014 at 9:33 PM, hacfi [email protected] wrote:

@xleliberty How do you set the image or how does your code look like?

Reply to this email directly or view it on GitHub:
#109 (comment)

from media-bundle.

dbu avatar dbu commented on July 28, 2024

bizar. are you using fixtures code or an upload? to debug, i would hack into the imagine block code to save a copy of the image to the file system to see if the data is already bad at that point. to narrow down at which point things go wrong...

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

Hi,
thanks for you advice.

I'm currently debugging , i hope i'll find something.
Xavier

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

I've still no luck with this problem...
i've tried debugging but problem seems to be at flush time.

if i dump image just before flushing the complete block (Sonata\DoctrinePHPCRAdminBundle\Model\ModelManager::create ) , the file is ok.
After, it's not...

i've checked again all vendor versions, and packages that matter ( phpcr stuff, jackalope, doctrine/phpcr-odm ) are same on the 2 projects ( symfony-cmf / my project )

Really no idea...

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

Well, the problem lies in doctrine/postgresql/bytea relations...
i've just change the database type of my symfony-cmf from sqlite to postgresql and then, same problem...
Things are not related to MediaBundle... i still investigate.

Xavier

from media-bundle.

dbu avatar dbu commented on July 28, 2024

uh, interesting. if you change your project to mysql / sqlite, does the problem go away? you could configure a separate dbal connection for jackalope if you use postgres for other things too. (not proposing this as a solution, just to narrow this down).

we seem to have a bunch of tests around binaries in phpcr-api-tests: https://github.com/phpcr/phpcr-api-tests/blob/master/tests/10_Writing/SetPropertyTypesTest.php#L49

but i notice that we set textual data as binary stream, not "real" binary data. if you can investigate further, one thing could be to checkout the jackalope-doctrine-dbal repository stand alone, configure phpunit.xml to run postgres and run the test suite, which should also run those tests. then you could add one more test in SetPropertyTypesTest with some non-printable binary data. if this fails too, we are pretty sure where the problem lies.

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

Well, i think i've finally isolated the problem.
I work on mac dev machine and use liip/php-osx , i think it's the culprit... it's compiled with an oooold version of libpq
PostgreSQL(libpq) Version 8.2.23
PostgreSQL(libpq) PostgreSQL 8.2.23 on i386-apple-darwin12.5.0, compiled by GCC Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)

It seems that this old libpq version doesn't handle cleanly bytea conversions .
i've just done a quick test that show the problem and a solution.

CREATE TABLE bintest
(
  id serial NOT NULL,
  data bytea,
  CONSTRAINT pkok PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);

<?php

//DATA insertion
$dbh = new PDO("pgsql:dbname=cmf;host=localhost", 'xav');
$thebytes = file_get_contents('source.jpg');

$sth = $dbh->prepare("INSERT INTO bintest ( data ) VALUES (:content)");
$sth->bindParam(':content', $thebytes, PDO::PARAM_LOB);
$sth->execute();


//DATA Reading

//If we use this line, everything is ok
$dbh->query("SET bytea_output=escape");

$sth = $dbh->prepare("SELECT data FROM bintest WHERE id = 1");
$sth->execute();

$content = $sth->fetchColumn();
file_put_contents('test.jpg', $content);

I'm currently reinstalling php from homebrew to verify that, i'll let you know.

Xavier

from media-bundle.

xleliberty avatar xleliberty commented on July 28, 2024

Ok, the end...

i confirm that in my case the culprit is liip/php-osx ...
i've just test again with php compiled with latest libpq and everything is fine.

Sorry for this noise, i close this.

Xavier

from media-bundle.

dbu avatar dbu commented on July 28, 2024

glad you found the issue. i see you created liip/php-osx#123 - i hope somebody here at liip can address this. (i am working on linux and never touch macs when i can avoid it :-)

from media-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.