Compare commits
No commits in common. "master" and "gh-pages" have entirely different histories.
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
upload/
|
||||
includes/datos.php
|
@ -1,8 +0,0 @@
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
includes/datos.php
|
675
LICENSE
@ -1,675 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
76
README.md
@ -1,76 +0,0 @@
|
||||
<pre>
|
||||
__ __ ___ ___ _______ _______
|
||||
| |_| || | | | | || |
|
||||
| || | | | | ___|| _____|
|
||||
| || | | | | |___ | |_____
|
||||
| || | | |___ | ___||_____ |
|
||||
| ||_|| || | | || | _____| |
|
||||
|_| |_||___| |_______||___| |_______|
|
||||
|
||||
</pre>
|
||||
|
||||
**DEFINICION**
|
||||
|
||||
MILFS es una aplicación web para en la captura de datos de forma ágil y su
|
||||
posterior proceso, a priori se puede ver como un sistema apra la creación
|
||||
de formularios pero su poder va mas allá, MILFS maneja los campos de los
|
||||
campos de los formularios de manera semántica lo que prermite su posterior
|
||||
interpretación, por ejemplo:
|
||||
|
||||
|
||||
Si necesitamos recabar datos en un evento creamos un formulario con los campos:
|
||||
1. Nombres
|
||||
1. Email
|
||||
1. Telefono
|
||||
|
||||
Estos campos solo los creamos la si no existen, luego para cada evento creamos
|
||||
un nuevo formulario y usamos los campos existentes y gracias a esto en la base
|
||||
de datos se almacenará siempre la información de "Nombres" en un campo "Nombres"
|
||||
lo cual le propporciona semántica a la información.
|
||||
|
||||
MILFS también cuenta con campos especiales como el de mapa el cual proporciona
|
||||
la posibilidad de georeferenciar los datos capturados y luego exibirlos como un
|
||||
mapa.
|
||||
|
||||
Si deseas capturar mucha información y almacenarla de manera estructurada o quieres
|
||||
reemplazar cientos de hojas electronicas por un sistema de datos, MILF es lo
|
||||
que estabas buscando.
|
||||
|
||||
MILFS también cuenta con un subsistema de importación que te permite subir datos
|
||||
almacenados en un archivo CSV.
|
||||
|
||||
Sabemos que aun nos falta mucha documentación para enseñar a manejar todo el poder
|
||||
de MILFS, Pero bueno, gracias por la ayuda ;-)
|
||||
|
||||
|
||||
**INSTALACION**
|
||||
|
||||
1. Volcar la base de datos MYSQL desde el archivo milfs.sql.gz
|
||||
1. Mover el directorio milfs a /var/www/html/milfs o un lugar accesible.
|
||||
1. Modificar el archivo milfs/includes/datos.php con los datos de acceso a la base de datos MySQL.
|
||||
1. Mover el directorio images_secure a un lugar no accesible via web /var/www/images_secure Dar permiso de escritura al www-data sobre images_secure y su contenido.
|
||||
1. Ingresar por http al aplicativo eje. http://localhost/milfs
|
||||
1. Loguearse con usuario admin clave admin
|
||||
1. Actualizar los datos de la instución en el área de configuración. Especialmente un email válido
|
||||
1. Salir de la aplicación
|
||||
1. Solicitar cambio de la contraseña.
|
||||
1. Revisar las instrucciones enviadas al email.
|
||||
1. La instalación básica de MILFS tiene algunos campos creados y un formulario de muestra llamado contacto.
|
||||
|
||||
|
||||
|
||||
**DISFRUTALO.**
|
||||
|
||||
<pre>
|
||||
#====#
|
||||
|___|__\___
|
||||
| _ | |_ |}
|
||||
"(_)"" ""(_)"
|
||||
</pre>
|
||||
|
||||
Twitter: @fredy_rivera
|
||||
@QWERTY.CO
|
||||
|
||||
https://qwerty.co/milfs
|
||||
|
||||
***
|
@ -1,510 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "500";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/logis/images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<div>
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px important!;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: <?echo $ancho ?>px;
|
||||
}
|
||||
body{
|
||||
background-color:white !important;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.pin {
|
||||
text-align: center;
|
||||
/*border: solid 1px red;*/
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
.ing-touch{
|
||||
border: solid 1px red;
|
||||
width:20% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class='container' style='backgroun-color:white;' >
|
||||
<div class='fileUpload btn btn-primary center-block'>
|
||||
<span><h1><i class="fa fa-camera"></i></h1></span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
|
||||
</div>
|
||||
<div class="row " style="position:relative">
|
||||
|
||||
|
||||
<form id='formulario_brigadistas' name='formulario_brigadistas' >
|
||||
<input class='form-control' type='' id="debugConsole" name="debugConsole" >
|
||||
<input type='' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div id='aviso'>Aviso</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?echo $ancho ?>px')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
displayExifData = function (exif) {
|
||||
var thumbnail = exif.get('Thumbnail'),
|
||||
tags = exif.getAll(),
|
||||
table = exifNode.find('table').empty(),
|
||||
row = $('<tr></tr>'),
|
||||
cell = $('<td></td>'),
|
||||
prop;
|
||||
if (thumbnail) {
|
||||
thumbNode.empty();
|
||||
loadImage(thumbnail, function (img) {
|
||||
thumbNode.append(img).show();
|
||||
}, {orientation: exif.get('Orientation')});
|
||||
}
|
||||
for (prop in tags) {
|
||||
if (tags.hasOwnProperty(prop)) {
|
||||
table.append(
|
||||
row.clone()
|
||||
.append(cell.clone().text(prop))
|
||||
.append(cell.clone().text(tags[prop]))
|
||||
);
|
||||
}
|
||||
}
|
||||
exifNode.show();
|
||||
},
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
maxWidth: result.width(),
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?echo $ancho ?>;
|
||||
micanvas.width =ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
var testCanvas = document.getElementById("micanvas");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
|
||||
debugConsole.value=canvasData;
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?echo $ancho ?>')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
displayExifData = function (exif) {
|
||||
var thumbnail = exif.get('Thumbnail'),
|
||||
tags = exif.getAll(),
|
||||
table = exifNode.find('table').empty(),
|
||||
row = $('<tr></tr>'),
|
||||
cell = $('<td></td>'),
|
||||
prop;
|
||||
if (thumbnail) {
|
||||
thumbNode.empty();
|
||||
loadImage(thumbnail, function (img) {
|
||||
thumbNode.append(img).show();
|
||||
}, {orientation: exif.get('Orientation')});
|
||||
}
|
||||
for (prop in tags) {
|
||||
if (tags.hasOwnProperty(prop)) {
|
||||
table.append(
|
||||
row.clone()
|
||||
.append(cell.clone().text(prop))
|
||||
.append(cell.clone().text(tags[prop]))
|
||||
);
|
||||
}
|
||||
}
|
||||
exifNode.show();
|
||||
},
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
maxWidth: result.width(),
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<!-- <script src="js/demo.js"></script> -->
|
||||
</div>
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
function brigadistas_grabar_imagen($data,$identificador) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$control = md5("$identificador");
|
||||
//$form_id = $fomulario["formulario_id"];
|
||||
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
|
||||
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
return $respuesta;
|
||||
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar_imagen");
|
||||
|
||||
function brigadistas_grabar($formulario) {
|
||||
|
||||
$identificador = $formulario['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $formulario['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#BrigadaDigital");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
|
||||
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
|
||||
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $formulario['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$formulario[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
|
||||
include_once("librerias/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
|
||||
foreach($formulario as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysqli_real_escape_string($link, $v )."')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$twitter = $formulario['498'][0];
|
||||
$_SESSION['logis'] = "$control";
|
||||
$_SESSION['mensaje'] = "$twitter";
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
||||
<h2 class='text-center'>$twitter<h2>
|
||||
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a target= 'twitter' href ='milfs/addon/logis/funciones/twitter/tuitear.php' ><i class='fa fa-twitter'></i></a>
|
||||
</span>
|
||||
<a href='S58'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
$resultado = "$preview ";
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar");
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Use to autoload needed classes without Composer.
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(function ($class) {
|
||||
|
||||
// project-specific namespace prefix
|
||||
$prefix = 'Abraham\\TwitterOAuth\\';
|
||||
|
||||
// base directory for the namespace prefix
|
||||
$base_dir = __DIR__ . '/src/';
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
// no, move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $len);
|
||||
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
// if the file exists, require it
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
Before Width: | Height: | Size: 38 KiB |
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
|
||||
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
|
||||
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/toa/hola.php');
|
||||
|
||||
?>
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
/*
|
||||
define('CONSUMER_KEY', getenv('wMtivKDSAgZmkP7EZhYcfw'));
|
||||
define('CONSUMER_SECRET', getenv('AvWbHfjuSJkZYhkxsU8ojsDpNtvapBoiRUzwF3OAvbo'));
|
||||
define('OAUTH_CALLBACK', getenv('http://datos.labmde.org/milfs/toa/hola.php'));
|
||||
*/
|
||||
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
|
||||
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
|
||||
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/addon/logis/funciones/twitter/hola.php');
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
|
||||
//print $connection; //print connection contents
|
||||
//$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
|
||||
$request_token = $connection->oauth('oauth/request_token');
|
||||
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
$user = $connection->get("account/verify_credentials");
|
||||
//print $user->screen_name;
|
||||
print_r($user);
|
||||
// Post Update
|
||||
|
||||
$content = $connection->post('statuses/update', array('status' => 'Bonito dia'));
|
||||
print_r( $content);
|
||||
print_r($url);
|
||||
|
||||
|
||||
//print_r($request_token); //print connection contentsa
|
||||
|
||||
|
||||
?>
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
require_once('config.php');
|
||||
|
||||
/* Crear un objeto TwitteroAuth con las credenciales de la aplicacion y el token temporal */
|
||||
//$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
|
||||
|
||||
/* Solicitar a twitter el token de acceso */
|
||||
//$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
|
||||
$access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
|
||||
|
||||
|
||||
/* Guardar el token de acceso. Normalmente, este token se guardará también en una base
|
||||
de datos para volver a ser utilizado en otras ocasiones. */
|
||||
$_SESSION['access_token'] = $access_token;
|
||||
|
||||
/* Eliminar el token temporal de solicitud */
|
||||
unset($_SESSION['oauth_token']);
|
||||
unset($_SESSION['oauth_token_secret']);
|
||||
|
||||
/* Si todo va bien, presentar al usuario la página principal "index.php" del servicio */
|
||||
//if (200 == $connection->http_code) {
|
||||
/* El usuario ha sido verificado */
|
||||
$_SESSION['status'] = 'verified';
|
||||
echo send_tweet($access_token);
|
||||
//}
|
||||
function base64_encode_image ($filename=string,$filetype=string) {
|
||||
if ($filename) {
|
||||
$imgbinary = fread(fopen($filename, "r"), filesize($filename));
|
||||
return base64_encode($imgbinary);
|
||||
}
|
||||
}
|
||||
|
||||
function send_tweet($access_token) {
|
||||
$tweet = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$access_token['oauth_token'], $access_token['oauth_token_secret']);
|
||||
$nombre= $_SESSION['logis'].".png";
|
||||
$nombre = "$_SESSION[path_images_secure]/600/$nombre";
|
||||
|
||||
$media1 = $tweet->upload('media/upload', array('media' => "$nombre"));
|
||||
$parameters = array('status' =>"$_SESSION[mensaje] #BrigadaDigital #CD2015 http://datos.labmde.org/jlogis",'media_ids' => implode(',', array($media1->media_id_string)),
|
||||
);
|
||||
|
||||
$result = $tweet-> post('statuses/update', $parameters);
|
||||
$image = "$nombre";
|
||||
$base64 = base64_encode_image (''.$image,'png');
|
||||
$result = $tweet-> post('account/update_profile_image', array('image' => $base64.';type=image/jpg;filename='.$image));
|
||||
|
||||
// $message = "Bonito dia $nombre";
|
||||
// $tweet->post('statuses/update', array('status' => "$message"));
|
||||
//
|
||||
}
|
||||
|
||||
header('Location: https://twitter.com/hashtag/CD2015');
|
||||
|
||||
// header('Location: ./index.php');
|
||||
//} else {
|
||||
//header('Location: ./clearsessions.php');
|
||||
//
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* Handle setting and storing config for TwitterOAuth.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/** @var int How long to wait for a response from the API */
|
||||
protected $timeout = 5;
|
||||
/** @var int how long to wait while connecting to the API */
|
||||
protected $connectionTimeout = 5;
|
||||
/**
|
||||
* Decode JSON Response as associative Array
|
||||
*
|
||||
* @see http://php.net/manual/en/function.json-decode.php
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $decodeJsonAsArray = false;
|
||||
/** @var string User-Agent header */
|
||||
protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)';
|
||||
/** @var array Store proxy connection details */
|
||||
protected $proxy = [];
|
||||
|
||||
/**
|
||||
* Set the connection and response timeouts.
|
||||
*
|
||||
* @param int $connectionTimeout
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function setTimeouts($connectionTimeout, $timeout)
|
||||
{
|
||||
$this->connectionTimeout = (int)$connectionTimeout;
|
||||
$this->timeout = (int)$timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setDecodeJsonAsArray($value)
|
||||
{
|
||||
$this->decodeJsonAsArray = (bool)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userAgent
|
||||
*/
|
||||
public function setUserAgent($userAgent)
|
||||
{
|
||||
$this->userAgent = (string)$userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $proxy
|
||||
*/
|
||||
public function setProxy(array $proxy)
|
||||
{
|
||||
$this->proxy = $proxy;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Consumer
|
||||
{
|
||||
/** @var string */
|
||||
public $key;
|
||||
/** @var string */
|
||||
public $secret;
|
||||
/** @var string|null */
|
||||
public $callbackUrl;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string $secret
|
||||
* @param null $callbackUrl
|
||||
*/
|
||||
public function __construct($key, $secret, $callbackUrl = null)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->secret = $secret;
|
||||
$this->callbackUrl = $callbackUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "Consumer[key=$this->key,secret=$this->secret]";
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
|
||||
* where the Signature Base String is the text and the key is the concatenated values (each first
|
||||
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
|
||||
* character (ASCII code 38) even if empty.
|
||||
* - Chapter 9.2 ("HMAC-SHA1")
|
||||
*/
|
||||
class HmacSha1 extends SignatureMethod
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "HMAC-SHA1";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildSignature(Request $request, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
$signatureBase = $request->getSignatureBaseString();
|
||||
|
||||
$parts = [$consumer->secret, null !== $token ? $token->secret : ""];
|
||||
|
||||
$parts = Util::urlencodeRfc3986($parts);
|
||||
$key = implode('&', $parts);
|
||||
|
||||
return base64_encode(hash_hmac('sha1', $signatureBase, $key, true));
|
||||
}
|
||||
}
|
@ -1,254 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Request
|
||||
{
|
||||
protected $parameters;
|
||||
protected $httpMethod;
|
||||
protected $httpUrl;
|
||||
public static $version = '1.0';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $httpMethod
|
||||
* @param string $httpUrl
|
||||
* @param array|null $parameters
|
||||
*/
|
||||
public function __construct($httpMethod, $httpUrl, array $parameters = [])
|
||||
{
|
||||
$parameters = array_merge(Util::parseParameters(parse_url($httpUrl, PHP_URL_QUERY)), $parameters);
|
||||
$this->parameters = $parameters;
|
||||
$this->httpMethod = $httpMethod;
|
||||
$this->httpUrl = $httpUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* pretty much a helper function to set up the request
|
||||
*
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
* @param string $httpMethod
|
||||
* @param string $httpUrl
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Request
|
||||
*/
|
||||
public static function fromConsumerAndToken(
|
||||
Consumer $consumer,
|
||||
Token $token = null,
|
||||
$httpMethod,
|
||||
$httpUrl,
|
||||
array $parameters = []
|
||||
) {
|
||||
$defaults = [
|
||||
"oauth_version" => Request::$version,
|
||||
"oauth_nonce" => Request::generateNonce(),
|
||||
"oauth_timestamp" => time(),
|
||||
"oauth_consumer_key" => $consumer->key
|
||||
];
|
||||
if (null !== $token) {
|
||||
$defaults['oauth_token'] = $token->key;
|
||||
}
|
||||
|
||||
$parameters = array_merge($defaults, $parameters);
|
||||
|
||||
return new Request($httpMethod, $httpUrl, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function setParameter($name, $value)
|
||||
{
|
||||
$this->parameters[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParameter($name)
|
||||
{
|
||||
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*/
|
||||
public function removeParameter($name)
|
||||
{
|
||||
unset($this->parameters[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The request parameters, sorted and concatenated into a normalized string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSignableParameters()
|
||||
{
|
||||
// Grab all parameters
|
||||
$params = $this->parameters;
|
||||
|
||||
// Remove oauth_signature if present
|
||||
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
|
||||
if (isset($params['oauth_signature'])) {
|
||||
unset($params['oauth_signature']);
|
||||
}
|
||||
|
||||
return Util::buildHttpQuery($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base string of this request
|
||||
*
|
||||
* The base string defined as the method, the url
|
||||
* and the parameters (normalized), each urlencoded
|
||||
* and the concated with &.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSignatureBaseString()
|
||||
{
|
||||
$parts = [
|
||||
$this->getNormalizedHttpMethod(),
|
||||
$this->getNormalizedHttpUrl(),
|
||||
$this->getSignableParameters()
|
||||
];
|
||||
|
||||
$parts = Util::urlencodeRfc3986($parts);
|
||||
|
||||
return implode('&', $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP Method in uppercase
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNormalizedHttpMethod()
|
||||
{
|
||||
return strtoupper($this->httpMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the url and rebuilds it to be
|
||||
* scheme://host/path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNormalizedHttpUrl()
|
||||
{
|
||||
$parts = parse_url($this->httpUrl);
|
||||
|
||||
$scheme = $parts['scheme'];
|
||||
$host = strtolower($parts['host']);
|
||||
$path = $parts['path'];
|
||||
|
||||
return "$scheme://$host$path";
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a url usable for a GET request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toUrl()
|
||||
{
|
||||
$postData = $this->toPostdata();
|
||||
$out = $this->getNormalizedHttpUrl();
|
||||
if ($postData) {
|
||||
$out .= '?' . $postData;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the data one would send in a POST request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toPostdata()
|
||||
{
|
||||
return Util::buildHttpQuery($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Authorization: header
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
public function toHeader()
|
||||
{
|
||||
$first = true;
|
||||
$out = 'Authorization: OAuth';
|
||||
foreach ($this->parameters as $k => $v) {
|
||||
if (substr($k, 0, 5) != "oauth") {
|
||||
continue;
|
||||
}
|
||||
if (is_array($v)) {
|
||||
throw new TwitterOAuthException('Arrays not supported in headers');
|
||||
}
|
||||
$out .= ($first) ? ' ' : ', ';
|
||||
$out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
|
||||
$first = false;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SignatureMethod $signatureMethod
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*/
|
||||
public function signRequest(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
$this->setParameter("oauth_signature_method", $signatureMethod->getName());
|
||||
$signature = $this->buildSignature($signatureMethod, $consumer, $token);
|
||||
$this->setParameter("oauth_signature", $signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SignatureMethod $signatureMethod
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildSignature(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
return $signatureMethod->buildSignature($this, $consumer, $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function generateNonce()
|
||||
{
|
||||
return md5(microtime() . mt_rand());
|
||||
}
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* The result of the most recent API request.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class Response
|
||||
{
|
||||
/** @var string|null API path from the most recent request */
|
||||
private $apiPath;
|
||||
/** @var int HTTP status code from the most recent request */
|
||||
private $httpCode = 0;
|
||||
/** @var array HTTP headers from the most recent request */
|
||||
private $headers = [];
|
||||
/** @var array|object Response body from the most recent request */
|
||||
private $body = [];
|
||||
/** @var array HTTP headers from the most recent request that start with X */
|
||||
private $xHeaders = [];
|
||||
|
||||
/**
|
||||
* @param string $apiPath
|
||||
*/
|
||||
public function setApiPath($apiPath)
|
||||
{
|
||||
$this->apiPath = $apiPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApiPath()
|
||||
{
|
||||
return $this->apiPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|object $body
|
||||
*/
|
||||
public function setBody($body)
|
||||
{
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|object|string
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $httpCode
|
||||
*/
|
||||
public function setHttpCode($httpCode)
|
||||
{
|
||||
$this->httpCode = $httpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHttpCode()
|
||||
{
|
||||
return $this->httpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
*/
|
||||
public function setHeaders($headers)
|
||||
{
|
||||
foreach ($headers as $key => $value) {
|
||||
if (substr($key, 0, 1) == 'x') {
|
||||
$this->xHeaders[$key] = $value;
|
||||
}
|
||||
}
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getsHeaders()
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $xHeaders
|
||||
*/
|
||||
public function setXHeaders($xHeaders)
|
||||
{
|
||||
$this->xHeaders = $xHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getXHeaders()
|
||||
{
|
||||
return $this->xHeaders;
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* A class for implementing a Signature Method
|
||||
* See section 9 ("Signing Requests") in the spec
|
||||
*/
|
||||
abstract class SignatureMethod
|
||||
{
|
||||
/**
|
||||
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getName();
|
||||
|
||||
/**
|
||||
* Build up the signature
|
||||
* NOTE: The output of this function MUST NOT be urlencoded.
|
||||
* the encoding is handled in OAuthRequest when the final
|
||||
* request is serialized
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function buildSignature(Request $request, Consumer $consumer, Token $token = null);
|
||||
|
||||
/**
|
||||
* Verifies that a given signature is correct
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
* @param string $signature
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
|
||||
{
|
||||
$built = $this->buildSignature($request, $consumer, $token);
|
||||
|
||||
// Check for zero length, although unlikely here
|
||||
if (strlen($built) == 0 || strlen($signature) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($built) != strlen($signature)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Avoid a timing leak with a (hopefully) time insensitive compare
|
||||
$result = 0;
|
||||
for ($i = 0; $i < strlen($signature); $i++) {
|
||||
$result |= ord($built{$i}) ^ ord($signature{$i});
|
||||
}
|
||||
|
||||
return $result == 0;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Token
|
||||
{
|
||||
/** @var string */
|
||||
public $key;
|
||||
/** @var string */
|
||||
public $secret;
|
||||
|
||||
/**
|
||||
* @param string $key The OAuth Token
|
||||
* @param string $secret The OAuth Token Secret
|
||||
*/
|
||||
public function __construct($key, $secret)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->secret = $secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the basic string serialization of a token that a server
|
||||
* would respond to request_token and access_token calls with
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf("oauth_token=%s&oauth_token_secret=%s",
|
||||
Util::urlencodeRfc3986($this->key),
|
||||
Util::urlencodeRfc3986($this->secret)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,448 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The most popular PHP library for use with the Twitter OAuth REST API.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
use Abraham\TwitterOAuth\Util\JsonDecoder;
|
||||
|
||||
/**
|
||||
* TwitterOAuth class for interacting with the Twitter API.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class TwitterOAuth extends Config
|
||||
{
|
||||
const API_VERSION = '1.1';
|
||||
const API_HOST = 'https://api.twitter.com';
|
||||
const UPLOAD_HOST = 'https://upload.twitter.com';
|
||||
const UPLOAD_CHUNK = 40960; // 1024 * 40
|
||||
|
||||
/** @var Response details about the result of the last request */
|
||||
private $response;
|
||||
/** @var string|null Application bearer token */
|
||||
private $bearer;
|
||||
/** @var Consumer Twitter application details */
|
||||
private $consumer;
|
||||
/** @var Token|null User access token details */
|
||||
private $token;
|
||||
/** @var HmacSha1 OAuth 1 signature type used by Twitter */
|
||||
private $signatureMethod;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $consumerKey The Application Consumer Key
|
||||
* @param string $consumerSecret The Application Consumer Secret
|
||||
* @param string|null $oauthToken The Client Token (optional)
|
||||
* @param string|null $oauthTokenSecret The Client Token Secret (optional)
|
||||
*/
|
||||
public function __construct($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$this->signatureMethod = new HmacSha1();
|
||||
$this->consumer = new Consumer($consumerKey, $consumerSecret);
|
||||
if (!empty($oauthToken) && !empty($oauthTokenSecret)) {
|
||||
$this->token = new Token($oauthToken, $oauthTokenSecret);
|
||||
}
|
||||
if (empty($oauthToken) && !empty($oauthTokenSecret)) {
|
||||
$this->bearer = $oauthTokenSecret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oauthToken
|
||||
* @param string $oauthTokenSecret
|
||||
*/
|
||||
public function setOauthToken($oauthToken, $oauthTokenSecret)
|
||||
{
|
||||
$this->token = new Token($oauthToken, $oauthTokenSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastApiPath()
|
||||
{
|
||||
return $this->response->getApiPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLastHttpCode()
|
||||
{
|
||||
return $this->response->getHttpCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLastXHeaders()
|
||||
{
|
||||
return $this->response->getXHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|object|null
|
||||
*/
|
||||
public function getLastBody()
|
||||
{
|
||||
return $this->response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the last response cache.
|
||||
*/
|
||||
public function resetLastResponse()
|
||||
{
|
||||
$this->response = new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make URLs for user browser navigation.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function url($path, array $parameters)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$query = http_build_query($parameters);
|
||||
return sprintf('%s/%s?%s', self::API_HOST, $path, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make /oauth/* requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
public function oauth($path, array $parameters = [])
|
||||
{
|
||||
$response = [];
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$url = sprintf('%s/%s', self::API_HOST, $path);
|
||||
$result = $this->oAuthRequest($url, 'POST', $parameters);
|
||||
|
||||
if ($this->getLastHttpCode() != 200) {
|
||||
throw new TwitterOAuthException($result);
|
||||
}
|
||||
|
||||
parse_str($result, $response);
|
||||
$this->response->setBody($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make /oauth2/* requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function oauth2($path, array $parameters = [])
|
||||
{
|
||||
$method = 'POST';
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$url = sprintf('%s/%s', self::API_HOST, $path);
|
||||
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
|
||||
$authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
|
||||
$result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
|
||||
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
|
||||
$this->response->setBody($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make GET requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function get($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('GET', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make POST requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function post($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('POST', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make DELETE requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function delete($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('DELETE', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make PUT requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function put($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('PUT', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload media to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
* @param boolean $chunked
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function upload($path, array $parameters = [], $chunked = false)
|
||||
{
|
||||
if ($chunked) {
|
||||
return $this->uploadMediaChunked($path, $parameters);
|
||||
} else {
|
||||
return $this->uploadMediaNotChunked($path, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private method to upload media (not chunked) to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function uploadMediaNotChunked($path, $parameters)
|
||||
{
|
||||
$file = file_get_contents($parameters['media']);
|
||||
$base = base64_encode($file);
|
||||
$parameters['media'] = $base;
|
||||
return $this->http('POST', self::UPLOAD_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private method to upload media (chunked) to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function uploadMediaChunked($path, $parameters)
|
||||
{
|
||||
// Init
|
||||
$init = $this->http('POST', self::UPLOAD_HOST, $path, [
|
||||
'command' => 'INIT',
|
||||
'media_type' => $parameters['media_type'],
|
||||
'total_bytes' => filesize($parameters['media'])
|
||||
]);
|
||||
// Append
|
||||
$segment_index = 0;
|
||||
$media = fopen($parameters['media'], 'rb');
|
||||
while (!feof($media))
|
||||
{
|
||||
$this->http('POST', self::UPLOAD_HOST, 'media/upload', [
|
||||
'command' => 'APPEND',
|
||||
'media_id' => $init->media_id_string,
|
||||
'segment_index' => $segment_index++,
|
||||
'media_data' => base64_encode(fread($media, self::UPLOAD_CHUNK))
|
||||
]);
|
||||
}
|
||||
fclose($media);
|
||||
// Finalize
|
||||
$finalize = $this->http('POST', self::UPLOAD_HOST, 'media/upload', [
|
||||
'command' => 'FINALIZE',
|
||||
'media_id' => $init->media_id_string
|
||||
]);
|
||||
return $finalize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function http($method, $host, $path, array $parameters)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
|
||||
$this->response->setApiPath($path);
|
||||
$result = $this->oAuthRequest($url, $method, $parameters);
|
||||
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
|
||||
$this->response->setBody($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format and sign an OAuth / API request
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
private function oAuthRequest($url, $method, array $parameters)
|
||||
{
|
||||
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
|
||||
if (array_key_exists('oauth_callback', $parameters)) {
|
||||
// Twitter doesn't like oauth_callback as a parameter.
|
||||
unset($parameters['oauth_callback']);
|
||||
}
|
||||
if ($this->bearer === null) {
|
||||
$request->signRequest($this->signatureMethod, $this->consumer, $this->token);
|
||||
$authorization = $request->toHeader();
|
||||
} else {
|
||||
$authorization = 'Authorization: Bearer ' . $this->bearer;
|
||||
}
|
||||
return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an HTTP request
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param string $authorization
|
||||
* @param array $postfields
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
private function request($url, $method, $authorization, $postfields)
|
||||
{
|
||||
/* Curl settings */
|
||||
$options = [
|
||||
// CURLOPT_VERBOSE => true,
|
||||
CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
|
||||
CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_HTTPHEADER => ['Accept: application/json', $authorization, 'Expect:'],
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYHOST => 2,
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
CURLOPT_TIMEOUT => $this->timeout,
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_USERAGENT => $this->userAgent,
|
||||
CURLOPT_ENCODING => 'gzip',
|
||||
];
|
||||
|
||||
if (!empty($this->proxy)) {
|
||||
$options[CURLOPT_PROXY] = $this->proxy['CURLOPT_PROXY'];
|
||||
$options[CURLOPT_PROXYUSERPWD] = $this->proxy['CURLOPT_PROXYUSERPWD'];
|
||||
$options[CURLOPT_PROXYPORT] = $this->proxy['CURLOPT_PROXYPORT'];
|
||||
$options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC;
|
||||
$options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
|
||||
}
|
||||
|
||||
switch ($method) {
|
||||
case 'GET':
|
||||
break;
|
||||
case 'POST':
|
||||
$options[CURLOPT_POST] = true;
|
||||
$options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
|
||||
break;
|
||||
case 'DELETE':
|
||||
$options[CURLOPT_CUSTOMREQUEST] = 'DELETE';
|
||||
break;
|
||||
case 'PUT':
|
||||
$options[CURLOPT_CUSTOMREQUEST] = 'PUT';
|
||||
break;
|
||||
}
|
||||
|
||||
if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields)) {
|
||||
$options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
|
||||
}
|
||||
|
||||
|
||||
$curlHandle = curl_init();
|
||||
curl_setopt_array($curlHandle, $options);
|
||||
$response = curl_exec($curlHandle);
|
||||
|
||||
// Throw exceptions on cURL errors.
|
||||
if (curl_errno($curlHandle) > 0) {
|
||||
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
|
||||
}
|
||||
|
||||
$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
|
||||
$parts = explode("\r\n\r\n", $response);
|
||||
$responseBody = array_pop($parts);
|
||||
$responseHeader = array_pop($parts);
|
||||
$this->response->setHeaders($this->parseHeaders($responseHeader));
|
||||
|
||||
curl_close($curlHandle);
|
||||
|
||||
return $responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header info to store.
|
||||
*
|
||||
* @param string $header
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function parseHeaders($header)
|
||||
{
|
||||
$headers = [];
|
||||
foreach (explode("\r\n", $header) as $line) {
|
||||
if (strpos($line, ':') !== false) {
|
||||
list ($key, $value) = explode(': ', $line);
|
||||
$key = str_replace('-', '_', strtolower($key));
|
||||
$headers[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode application authorization header with base64.
|
||||
*
|
||||
* @param Consumer $consumer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function encodeAppAuthorization($consumer)
|
||||
{
|
||||
// TODO: key and secret should be rfc 1738 encoded
|
||||
$key = $consumer->key;
|
||||
$secret = $consumer->secret;
|
||||
return base64_encode($key . ':' . $secret);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class TwitterOAuthException extends \Exception
|
||||
{
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Util
|
||||
{
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public static function urlencodeRfc3986($input)
|
||||
{
|
||||
$output = '';
|
||||
if (is_array($input)) {
|
||||
$output = array_map([__NAMESPACE__ . '\Util', 'urlencodeRfc3986'], $input);
|
||||
} elseif (is_scalar($input)) {
|
||||
$output = rawurlencode($input);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function urldecodeRfc3986($string)
|
||||
{
|
||||
return urldecode($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes a input like a=b&a=c&d=e and returns the parsed
|
||||
* parameters like this
|
||||
* array('a' => array('b','c'), 'd' => 'e')
|
||||
*
|
||||
* @param mixed $input
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parseParameters($input)
|
||||
{
|
||||
if (!isset($input) || !$input) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$pairs = explode('&', $input);
|
||||
|
||||
$parameters = [];
|
||||
foreach ($pairs as $pair) {
|
||||
$split = explode('=', $pair, 2);
|
||||
$parameter = Util::urldecodeRfc3986($split[0]);
|
||||
$value = isset($split[1]) ? Util::urldecodeRfc3986($split[1]) : '';
|
||||
|
||||
if (isset($parameters[$parameter])) {
|
||||
// We have already recieved parameter(s) with this name, so add to the list
|
||||
// of parameters with this name
|
||||
|
||||
if (is_scalar($parameters[$parameter])) {
|
||||
// This is the first duplicate, so transform scalar (string) into an array
|
||||
// so we can add the duplicates
|
||||
$parameters[$parameter] = [$parameters[$parameter]];
|
||||
}
|
||||
|
||||
$parameters[$parameter][] = $value;
|
||||
} else {
|
||||
$parameters[$parameter] = $value;
|
||||
}
|
||||
}
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function buildHttpQuery($params)
|
||||
{
|
||||
if (!$params) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Urlencode both keys and values
|
||||
$keys = Util::urlencodeRfc3986(array_keys($params));
|
||||
$values = Util::urlencodeRfc3986(array_values($params));
|
||||
$params = array_combine($keys, $values);
|
||||
|
||||
// Parameters are sorted by name, using lexicographical byte value ordering.
|
||||
// Ref: Spec: 9.1.1 (1)
|
||||
uksort($params, 'strcmp');
|
||||
|
||||
$pairs = [];
|
||||
foreach ($params as $parameter => $value) {
|
||||
if (is_array($value)) {
|
||||
// If two or more parameters share the same name, they are sorted by their value
|
||||
// Ref: Spec: 9.1.1 (1)
|
||||
// June 12th, 2010 - changed to sort because of issue 164 by hidetaka
|
||||
sort($value, SORT_STRING);
|
||||
foreach ($value as $duplicateValue) {
|
||||
$pairs[] = $parameter . '=' . $duplicateValue;
|
||||
}
|
||||
} else {
|
||||
$pairs[] = $parameter . '=' . $value;
|
||||
}
|
||||
}
|
||||
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
|
||||
// Each name-value pair is separated by an '&' character (ASCII code 38)
|
||||
return implode('&', $pairs);
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth\Util;
|
||||
|
||||
/**
|
||||
* @author louis <louis@systemli.org>
|
||||
*/
|
||||
class JsonDecoder
|
||||
{
|
||||
/**
|
||||
* Decodes a JSON string to stdObject or associative array
|
||||
*
|
||||
* @param string $string
|
||||
* @param bool $asArray
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public static function decode($string, $asArray)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
||||
return json_decode($string, $asArray, 512, JSON_BIGINT_AS_STRING);
|
||||
}
|
||||
|
||||
return json_decode($string, $asArray);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
ini_set('display_errors', 1);
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
require_once('config.php');
|
||||
|
||||
/* Prepara la conexión */
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
|
||||
|
||||
/* Solicita a twitter las credenciales temporales */
|
||||
//$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
|
||||
$request_token = $connection->oauth('oauth/request_token');
|
||||
|
||||
/* Guarda la credenciales temporales en sesión. */
|
||||
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
|
||||
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
|
||||
//switch ($connection->http_code) {
|
||||
// case 200:
|
||||
/* Construye la url de autorización y envía al usuario a Twitter. */
|
||||
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
//$url = $connection->getAuthorizeURL($token);
|
||||
// print $url;
|
||||
header('Location: ' . $url);
|
||||
//break;
|
||||
// default:
|
||||
/* Indica que se ha producido un error. */
|
||||
// echo 'Error de conexión a Twitter.';
|
||||
// echo "\nHTTP CODE: " . $connection->http_code;
|
||||
//}
|
@ -1,177 +0,0 @@
|
||||
<?php session_start();
|
||||
ini_set('display_errors', 'On');
|
||||
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
|
||||
include_once("$_SESSION[path]/funciones/conex.php");
|
||||
echo brigadistas_grabar($_POST);
|
||||
function brigadistas_grabar($formulario) {
|
||||
|
||||
$identificador = $_POST['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $_POST['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#BrigadaDigital");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
||||
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
|
||||
</span>
|
||||
<a href='?set=$formulario[formulario_id]&embebido'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
//$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $_POST['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$_POST[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
include_once("$_SESSION[path]/funciones/conex.php");
|
||||
//include_once("$_SESSION[url]funciones/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
$ip = obtener_ip();
|
||||
$ip = " INET_ATON('".$ip."') ";
|
||||
foreach($_POST as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultado = "$preview $consulta ";
|
||||
|
||||
///$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $resultado;
|
||||
}
|
||||
function remplacetas($tabla,$campo,$valor,$por,$and){
|
||||
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
|
||||
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
|
||||
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
if (@mysqli_num_rows($sql)!=0){
|
||||
$resultado[] = mysqli_result($sql,0,$por);
|
||||
$resultado[] = mysqli_result($sql,0,'id');
|
||||
$resultado[] = $consulta;
|
||||
$resultado[] = mysqli_result($sql,0,"md5_$por");
|
||||
}else{
|
||||
$resultado[0] = '';
|
||||
$resultado[1] ="";
|
||||
$resultado[2] = $consulta;
|
||||
$resultado[3] = NULL;
|
||||
}
|
||||
return $resultado;
|
||||
}
|
||||
|
||||
function grabar_imagen($imagen,$control) {
|
||||
|
||||
$imgData = str_replace(' ','+',$imagen);
|
||||
$imgData = substr($imgData,strpos($imgData,",")+1);
|
||||
$imgData = base64_decode($imgData);
|
||||
|
||||
$nombre= $control.".png";
|
||||
$filePath = "$_SESSION[path]/tmp/".$nombre;
|
||||
|
||||
$file = fopen($filePath, 'w');
|
||||
fwrite($file, $imgData);
|
||||
fclose($file);
|
||||
$full= "$_SESSION[path_images_secure]/full/".$nombre;
|
||||
if (!rename($filePath,$full)){}
|
||||
else {
|
||||
echo generar_miniatura($nombre,"150");
|
||||
echo generar_miniatura($nombre,"300");
|
||||
echo generar_miniatura($nombre,"600");
|
||||
}
|
||||
|
||||
//return "$nombre";
|
||||
return "$nombre";
|
||||
}
|
||||
|
||||
|
||||
function generar_miniatura($file,$width) {
//$archivo = $file;
|
||||
$archivo = "$_SESSION[path_images_secure]/full/".$file;
// Ponemos el . antes del nombre del archivo porque estamos considerando que la ruta está a partir del archivo thumb.php
$file_info = getimagesize($archivo);
// Obtenemos la relación de aspecto
$ratio = $file_info[0] / $file_info[1];
// Calculamos las nuevas dimensiones
$newwidth = $width;
$newheight = round($newwidth / $ratio);
// Sacamos la extensión del archivo
$ext = explode(".", $file);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") $ext = "jpg";
// Dependiendo de la extensión llamamos a distintas funciones
switch ($ext) {
case "jpg":
$img = imagecreatefromjpeg($archivo);
break;
case "png":
$img = imagecreatefrompng($archivo);
break;
case "gif":
$img = imagecreatefromgif($archivo);
break;
}
// Creamos la miniatura
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagealphablending( $thumb, false );
|
||||
imagesavealpha( $thumb, true );
// La redimensionamos
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $file_info[0], $file_info[1]);
// La mostramos como jpg
//header("Content-type: image/jpeg");
imagejpeg($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 80);
|
||||
imagepng($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 9);
|
||||
//imagegif($thumb,"$_SESSION[path_images_secure]/".$width."/$file");
|
||||
//imagejpeg($thumb,null, 80);
|
||||
}
|
||||
|
||||
function buscar_campo_tipo($id,$tipo) {
|
||||
//// esta función retorna el id para un campo de un tipo especifico dentro de un formulario.
|
||||
$consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo,form_campos,form_contenido_campos
|
||||
WHERE form_tipo_campo.id_tipo_campo = form_campos.campo_tipo
|
||||
AND form_contenido_campos.id_campo = form_campos.id
|
||||
AND form_tipo_campo.id_tipo_campo = '$tipo'
|
||||
AND form_contenido_campos.id_form = '$id'";
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
if (mysqli_num_rows($sql)!='0'){
|
||||
$resultado[0]=mysqli_result($sql,0,"id");
|
||||
$resultado[1]=mysqli_result($sql,0,"campo_nombre");
|
||||
$resultado[2] =$consulta;
|
||||
}else{ $resultado[0]='';
|
||||
$resultado[2] =$consulta;
|
||||
}
|
||||
return $resultado;
|
||||
}
|
||||
|
||||
function obtener_ip()
|
||||
|
||||
{
|
||||
|
||||
if (isset($_SERVER["HTTP_CLIENT_IP"]))
|
||||
{
|
||||
return $_SERVER["HTTP_CLIENT_IP"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
|
||||
{
|
||||
return $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
|
||||
{
|
||||
return $_SERVER["HTTP_X_FORWARDED"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
|
||||
{
|
||||
return $_SERVER["HTTP_FORWARDED_FOR"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_FORWARDED"]))
|
||||
{
|
||||
return $_SERVER["HTTP_FORWARDED"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 38 KiB |
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Demo JS 1.9.1
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Meta 1.0.2
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Image meta data handling implementation
|
||||
* based on the help and contribution of
|
||||
* Achim Stöhr.
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint continue:true */
|
||||
/*global define, window, DataView, Blob, Uint8Array, console */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['load-image'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.loadImage);
|
||||
}
|
||||
}(function (loadImage) {
|
||||
'use strict';
|
||||
|
||||
var hasblobSlice = window.Blob && (Blob.prototype.slice ||
|
||||
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
||||
|
||||
loadImage.blobSlice = hasblobSlice && function () {
|
||||
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
||||
return slice.apply(this, arguments);
|
||||
};
|
||||
|
||||
loadImage.metaDataParsers = {
|
||||
jpeg: {
|
||||
0xffe1: [] // APP1 marker
|
||||
}
|
||||
};
|
||||
|
||||
// Parses image meta data and calls the callback with an object argument
|
||||
// with the following properties:
|
||||
// * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10)
|
||||
// The options arguments accepts an object and supports the following properties:
|
||||
// * maxMetaDataSize: Defines the maximum number of bytes to parse.
|
||||
// * disableImageHead: Disables creating the imageHead property.
|
||||
loadImage.parseMetaData = function (file, callback, options) {
|
||||
options = options || {};
|
||||
var that = this,
|
||||
// 256 KiB should contain all EXIF/ICC/IPTC segments:
|
||||
maxMetaDataSize = options.maxMetaDataSize || 262144,
|
||||
data = {},
|
||||
noMetaData = !(window.DataView && file && file.size >= 12 &&
|
||||
file.type === 'image/jpeg' && loadImage.blobSlice);
|
||||
if (noMetaData || !loadImage.readFile(
|
||||
loadImage.blobSlice.call(file, 0, maxMetaDataSize),
|
||||
function (e) {
|
||||
if (e.target.error) {
|
||||
// FileReader error
|
||||
console.log(e.target.error);
|
||||
callback(data);
|
||||
return;
|
||||
}
|
||||
// Note on endianness:
|
||||
// Since the marker and length bytes in JPEG files are always
|
||||
// stored in big endian order, we can leave the endian parameter
|
||||
// of the DataView methods undefined, defaulting to big endian.
|
||||
var buffer = e.target.result,
|
||||
dataView = new DataView(buffer),
|
||||
offset = 2,
|
||||
maxOffset = dataView.byteLength - 4,
|
||||
headLength = offset,
|
||||
markerBytes,
|
||||
markerLength,
|
||||
parsers,
|
||||
i;
|
||||
// Check for the JPEG marker (0xffd8):
|
||||
if (dataView.getUint16(0) === 0xffd8) {
|
||||
while (offset < maxOffset) {
|
||||
markerBytes = dataView.getUint16(offset);
|
||||
// Search for APPn (0xffeN) and COM (0xfffe) markers,
|
||||
// which contain application-specific meta-data like
|
||||
// Exif, ICC and IPTC data and text comments:
|
||||
if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||
|
||||
markerBytes === 0xfffe) {
|
||||
// The marker bytes (2) are always followed by
|
||||
// the length bytes (2), indicating the length of the
|
||||
// marker segment, which includes the length bytes,
|
||||
// but not the marker bytes, so we add 2:
|
||||
markerLength = dataView.getUint16(offset + 2) + 2;
|
||||
if (offset + markerLength > dataView.byteLength) {
|
||||
console.log('Invalid meta data: Invalid segment size.');
|
||||
break;
|
||||
}
|
||||
parsers = loadImage.metaDataParsers.jpeg[markerBytes];
|
||||
if (parsers) {
|
||||
for (i = 0; i < parsers.length; i += 1) {
|
||||
parsers[i].call(
|
||||
that,
|
||||
dataView,
|
||||
offset,
|
||||
markerLength,
|
||||
data,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
offset += markerLength;
|
||||
headLength = offset;
|
||||
} else {
|
||||
// Not an APPn or COM marker, probably safe to
|
||||
// assume that this is the end of the meta data
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Meta length must be longer than JPEG marker (2)
|
||||
// plus APPn marker (2), followed by length bytes (2):
|
||||
if (!options.disableImageHead && headLength > 6) {
|
||||
if (buffer.slice) {
|
||||
data.imageHead = buffer.slice(0, headLength);
|
||||
} else {
|
||||
// Workaround for IE10, which does not yet
|
||||
// support ArrayBuffer.slice:
|
||||
data.imageHead = new Uint8Array(buffer)
|
||||
.subarray(0, headLength);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('Invalid JPEG file: Missing JPEG marker.');
|
||||
}
|
||||
callback(data);
|
||||
},
|
||||
'readAsArrayBuffer'
|
||||
)) {
|
||||
callback(data);
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
@ -1,166 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Orientation 1.1.0
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*global define, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['load-image'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.loadImage);
|
||||
}
|
||||
}(function (loadImage) {
|
||||
'use strict';
|
||||
|
||||
var originalHasCanvasOption = loadImage.hasCanvasOption,
|
||||
originalTransformCoordinates = loadImage.transformCoordinates,
|
||||
originalGetTransformedOptions = loadImage.getTransformedOptions;
|
||||
|
||||
// This method is used to determine if the target image
|
||||
// should be a canvas element:
|
||||
loadImage.hasCanvasOption = function (options) {
|
||||
return originalHasCanvasOption.call(loadImage, options) ||
|
||||
options.orientation;
|
||||
};
|
||||
|
||||
// Transform image orientation based on
|
||||
// the given EXIF orientation option:
|
||||
loadImage.transformCoordinates = function (canvas, options) {
|
||||
originalTransformCoordinates.call(loadImage, canvas, options);
|
||||
var ctx = canvas.getContext('2d'),
|
||||
width = canvas.width,
|
||||
height = canvas.height,
|
||||
orientation = options.orientation;
|
||||
if (!orientation || orientation > 8) {
|
||||
return;
|
||||
}
|
||||
if (orientation > 4) {
|
||||
canvas.width = height;
|
||||
canvas.height = width;
|
||||
}
|
||||
switch (orientation) {
|
||||
case 2:
|
||||
// horizontal flip
|
||||
ctx.translate(width, 0);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 3:
|
||||
// 180° rotate left
|
||||
ctx.translate(width, height);
|
||||
ctx.rotate(Math.PI);
|
||||
break;
|
||||
case 4:
|
||||
// vertical flip
|
||||
ctx.translate(0, height);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 5:
|
||||
// vertical flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 6:
|
||||
// 90° rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(0, -height);
|
||||
break;
|
||||
case 7:
|
||||
// horizontal flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(width, -height);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 8:
|
||||
// 90° rotate left
|
||||
ctx.rotate(-0.5 * Math.PI);
|
||||
ctx.translate(-width, 0);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Transforms coordinate and dimension options
|
||||
// based on the given orientation option:
|
||||
loadImage.getTransformedOptions = function (img, opts) {
|
||||
var options = originalGetTransformedOptions.call(loadImage, img, opts),
|
||||
orientation = options.orientation,
|
||||
newOptions,
|
||||
i;
|
||||
if (!orientation || orientation > 8 || orientation === 1) {
|
||||
return options;
|
||||
}
|
||||
newOptions = {};
|
||||
for (i in options) {
|
||||
if (options.hasOwnProperty(i)) {
|
||||
newOptions[i] = options[i];
|
||||
}
|
||||
}
|
||||
switch (options.orientation) {
|
||||
case 2:
|
||||
// horizontal flip
|
||||
newOptions.left = options.right;
|
||||
newOptions.right = options.left;
|
||||
break;
|
||||
case 3:
|
||||
// 180° rotate left
|
||||
newOptions.left = options.right;
|
||||
newOptions.top = options.bottom;
|
||||
newOptions.right = options.left;
|
||||
newOptions.bottom = options.top;
|
||||
break;
|
||||
case 4:
|
||||
// vertical flip
|
||||
newOptions.top = options.bottom;
|
||||
newOptions.bottom = options.top;
|
||||
break;
|
||||
case 5:
|
||||
// vertical flip + 90 rotate right
|
||||
newOptions.left = options.top;
|
||||
newOptions.top = options.left;
|
||||
newOptions.right = options.bottom;
|
||||
newOptions.bottom = options.right;
|
||||
break;
|
||||
case 6:
|
||||
// 90° rotate right
|
||||
newOptions.left = options.top;
|
||||
newOptions.top = options.right;
|
||||
newOptions.right = options.bottom;
|
||||
newOptions.bottom = options.left;
|
||||
break;
|
||||
case 7:
|
||||
// horizontal flip + 90 rotate right
|
||||
newOptions.left = options.bottom;
|
||||
newOptions.top = options.right;
|
||||
newOptions.right = options.top;
|
||||
newOptions.bottom = options.left;
|
||||
break;
|
||||
case 8:
|
||||
// 90° rotate left
|
||||
newOptions.left = options.bottom;
|
||||
newOptions.top = options.left;
|
||||
newOptions.right = options.top;
|
||||
newOptions.bottom = options.right;
|
||||
break;
|
||||
}
|
||||
if (options.orientation > 4) {
|
||||
newOptions.maxWidth = options.maxHeight;
|
||||
newOptions.maxHeight = options.maxWidth;
|
||||
newOptions.minWidth = options.minHeight;
|
||||
newOptions.minHeight = options.minWidth;
|
||||
newOptions.sourceWidth = options.sourceHeight;
|
||||
newOptions.sourceHeight = options.sourceWidth;
|
||||
}
|
||||
return newOptions;
|
||||
};
|
||||
|
||||
}));
|
1
addon/brigada/js/load-image.all.min.js
vendored
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image 1.10.0
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true */
|
||||
/*global define, window, document, URL, webkitURL, Blob, File, FileReader */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Loads an image for a given File object.
|
||||
// Invokes the callback with an img or optional canvas
|
||||
// element (if supported by the browser) as parameter:
|
||||
var loadImage = function (file, callback, options) {
|
||||
var img = document.createElement('img'),
|
||||
url,
|
||||
oUrl;
|
||||
//img.setAttribute('class', 'watermark');
|
||||
// img.setAttribute('id', 'image_output2');
|
||||
img.onerror = callback;
|
||||
img.onload = function () {
|
||||
if (oUrl && !(options && options.noRevoke)) {
|
||||
loadImage.revokeObjectURL(oUrl);
|
||||
}
|
||||
if (callback) {
|
||||
callback(loadImage.scale(img, options));
|
||||
}
|
||||
};
|
||||
if (loadImage.isInstanceOf('Blob', file) ||
|
||||
// Files are also Blob instances, but some browsers
|
||||
// (Firefox 3.6) support the File API but not Blobs:
|
||||
loadImage.isInstanceOf('File', file)) {
|
||||
url = oUrl = loadImage.createObjectURL(file);
|
||||
// Store the file type for resize processing:
|
||||
img._type = file.type;
|
||||
} else if (typeof file === 'string') {
|
||||
url = file;
|
||||
if (options && options.crossOrigin) {
|
||||
img.crossOrigin = options.crossOrigin;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (url) {
|
||||
img.src = url;
|
||||
//document.getElementById('image_output').src = url ;
|
||||
//document.getElementById('image_output').className = "watermark" ;
|
||||
return img;
|
||||
}
|
||||
return loadImage.readFile(file, function (e) {
|
||||
var target = e.target;
|
||||
if (target && target.result) {
|
||||
img.src = target.result;
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
|
||||
// which provides URL.createObjectURL but doesn't properly implement it:
|
||||
urlAPI = (window.createObjectURL && window) ||
|
||||
(window.URL && URL.revokeObjectURL && URL) ||
|
||||
(window.webkitURL && webkitURL);
|
||||
|
||||
loadImage.isInstanceOf = function (type, obj) {
|
||||
// Cross-frame instanceof check
|
||||
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
||||
};
|
||||
|
||||
// Transform image coordinates, allows to override e.g.
|
||||
// the canvas orientation based on the orientation option,
|
||||
// gets canvas, options passed as arguments:
|
||||
loadImage.transformCoordinates = function () {
|
||||
return;
|
||||
};
|
||||
|
||||
// Returns transformed options, allows to override e.g.
|
||||
// maxWidth, maxHeight and crop options based on the aspectRatio.
|
||||
// gets img, options passed as arguments:
|
||||
loadImage.getTransformedOptions = function (img, options) {
|
||||
var aspectRatio = options.aspectRatio,
|
||||
newOptions,
|
||||
i,
|
||||
width,
|
||||
height;
|
||||
if (!aspectRatio) {
|
||||
return options;
|
||||
}
|
||||
newOptions = {};
|
||||
for (i in options) {
|
||||
if (options.hasOwnProperty(i)) {
|
||||
newOptions[i] = options[i];
|
||||
}
|
||||
}
|
||||
newOptions.crop = true;
|
||||
width = img.naturalWidth || img.width;
|
||||
height = img.naturalHeight || img.height;
|
||||
if (width / height > aspectRatio) {
|
||||
newOptions.maxWidth = height * aspectRatio;
|
||||
newOptions.maxHeight = height;
|
||||
} else {
|
||||
newOptions.maxWidth = width;
|
||||
newOptions.maxHeight = width / aspectRatio;
|
||||
}
|
||||
return newOptions;
|
||||
};
|
||||
|
||||
// Canvas render method, allows to override the
|
||||
// rendering e.g. to work around issues on iOS:
|
||||
loadImage.renderImageToCanvas = function (
|
||||
canvas,
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
destX,
|
||||
destY,
|
||||
destWidth,
|
||||
destHeight
|
||||
) {
|
||||
canvas.getContext('2d').drawImage(
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
destX,
|
||||
destY,
|
||||
destWidth,
|
||||
destHeight
|
||||
);
|
||||
return canvas;
|
||||
};
|
||||
|
||||
// This method is used to determine if the target image
|
||||
// should be a canvas element:
|
||||
loadImage.hasCanvasOption = function (options) {
|
||||
return options.canvas || options.crop || options.aspectRatio;
|
||||
};
|
||||
|
||||
// Scales and/or crops the given image (img or canvas HTML element)
|
||||
// using the given options.
|
||||
// Returns a canvas object if the browser supports canvas
|
||||
// and the hasCanvasOption method returns true or a canvas
|
||||
// object is passed as image, else the scaled image:
|
||||
loadImage.scale = function (img, options) {
|
||||
options = options || {};
|
||||
var canvas = document.createElement('canvas'),
|
||||
useCanvas = img.getContext ||
|
||||
(loadImage.hasCanvasOption(options) && canvas.getContext),
|
||||
width = img.naturalWidth || img.width,
|
||||
height = img.naturalHeight || img.height,
|
||||
destWidth = width,
|
||||
destHeight = height,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
minWidth,
|
||||
minHeight,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
sourceX,
|
||||
sourceY,
|
||||
tmp,
|
||||
scaleUp = function () {
|
||||
var scale = Math.max(
|
||||
(minWidth || destWidth) / destWidth,
|
||||
(minHeight || destHeight) / destHeight
|
||||
);
|
||||
if (scale > 1) {
|
||||
destWidth = destWidth * scale;
|
||||
destHeight = destHeight * scale;
|
||||
}
|
||||
},
|
||||
scaleDown = function () {
|
||||
var scale = Math.min(
|
||||
(maxWidth || destWidth) / destWidth,
|
||||
(maxHeight || destHeight) / destHeight
|
||||
);
|
||||
if (scale < 1) {
|
||||
destWidth = destWidth * scale;
|
||||
destHeight = destHeight * scale;
|
||||
}
|
||||
};
|
||||
if (useCanvas) {
|
||||
options = loadImage.getTransformedOptions(img, options);
|
||||
sourceX = options.left || 0;
|
||||
sourceY = options.top || 0;
|
||||
if (options.sourceWidth) {
|
||||
sourceWidth = options.sourceWidth;
|
||||
if (options.right !== undefined && options.left === undefined) {
|
||||
sourceX = width - sourceWidth - options.right;
|
||||
}
|
||||
} else {
|
||||
sourceWidth = width - sourceX - (options.right || 0);
|
||||
}
|
||||
if (options.sourceHeight) {
|
||||
sourceHeight = options.sourceHeight;
|
||||
if (options.bottom !== undefined && options.top === undefined) {
|
||||
sourceY = height - sourceHeight - options.bottom;
|
||||
}
|
||||
} else {
|
||||
sourceHeight = height - sourceY - (options.bottom || 0);
|
||||
}
|
||||
destWidth = sourceWidth;
|
||||
destHeight = sourceHeight;
|
||||
}
|
||||
maxWidth = options.maxWidth;
|
||||
maxHeight = options.maxHeight;
|
||||
minWidth = options.minWidth;
|
||||
minHeight = options.minHeight;
|
||||
if (useCanvas && maxWidth && maxHeight && options.crop) {
|
||||
destWidth = maxWidth;
|
||||
destHeight = maxHeight;
|
||||
tmp = sourceWidth / sourceHeight - maxWidth / maxHeight;
|
||||
if (tmp < 0) {
|
||||
sourceHeight = maxHeight * sourceWidth / maxWidth;
|
||||
if (options.top === undefined && options.bottom === undefined) {
|
||||
sourceY = (height - sourceHeight) / 2;
|
||||
}
|
||||
} else if (tmp > 0) {
|
||||
sourceWidth = maxWidth * sourceHeight / maxHeight;
|
||||
if (options.left === undefined && options.right === undefined) {
|
||||
sourceX = (width - sourceWidth) / 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (options.contain || options.cover) {
|
||||
minWidth = maxWidth = maxWidth || minWidth;
|
||||
minHeight = maxHeight = maxHeight || minHeight;
|
||||
}
|
||||
if (options.cover) {
|
||||
scaleDown();
|
||||
scaleUp();
|
||||
} else {
|
||||
scaleUp();
|
||||
scaleDown();
|
||||
}
|
||||
}
|
||||
if (useCanvas) {
|
||||
canvas.width = destWidth;
|
||||
canvas.height = destHeight;
|
||||
loadImage.transformCoordinates(
|
||||
canvas,
|
||||
options
|
||||
);
|
||||
return loadImage.renderImageToCanvas(
|
||||
canvas,
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
0,
|
||||
0,
|
||||
destWidth,
|
||||
destHeight
|
||||
);
|
||||
}
|
||||
img.width = destWidth;
|
||||
img.height = destHeight;
|
||||
return img;
|
||||
};
|
||||
|
||||
loadImage.createObjectURL = function (file) {
|
||||
return urlAPI ? urlAPI.createObjectURL(file) : false;
|
||||
};
|
||||
|
||||
loadImage.revokeObjectURL = function (url) {
|
||||
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
|
||||
};
|
||||
|
||||
// Loads a given File object via FileReader interface,
|
||||
// invokes the callback with the event object (load or error).
|
||||
// The result can be read via event.target.result:
|
||||
loadImage.readFile = function (file, callback, method) {
|
||||
if (window.FileReader) {
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = fileReader.onerror = callback;
|
||||
method = method || 'readAsDataURL';
|
||||
if (fileReader[method]) {
|
||||
fileReader[method](file);
|
||||
return fileReader;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return loadImage;
|
||||
});
|
||||
} else {
|
||||
$.loadImage = loadImage;
|
||||
}
|
||||
}(window));
|
@ -1,363 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/logis/images/logos/250.png";
|
||||
$imagen="";
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<div>
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px important!;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: <?echo $ancho ?>px;
|
||||
}
|
||||
body{
|
||||
background-color:white !important;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.pin {
|
||||
text-align: center;
|
||||
/*border: solid 1px red;*/
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
.ing-touch{
|
||||
border: solid 5px white;
|
||||
width:20% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class='container' style='height:100%; backgroun-color:white;' id='aviso'>
|
||||
|
||||
<div class='fileUpload btn btn-primary center-block'>
|
||||
<span><h1><i class="fa fa-camera"></i> + tu Foto</h1></span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<canvas id="micanvasOriginal" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
|
||||
</div>
|
||||
<div class="row " style="position:relative">
|
||||
|
||||
|
||||
<form id='formulario_brigadistas' name='formulario_brigadistas' >
|
||||
<!-- <input class='form-control' type='' id="debugConsole" name="debugConsole" > -->
|
||||
<textarea class='form-control' id="debugConsole" name="debugConsole" style="display:none;" ></textarea>
|
||||
<input type='hidden' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- <div id='aviso'></div> -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) -->
|
||||
<!-- <button class='fileUpload btn btn-success btn-block' onclick="document.getElementById('formulario_brigadistas').submit(); "> -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) ; ">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $ultimo = formulario_uso("$id_formulario",'','ultimo') ;
|
||||
//echo $ultimo[1];
|
||||
echo mostrar_identificador("$ultimo[1]","","landingpage",'simple');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?echo $ancho ?>;
|
||||
micanvas.width =ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
var testCanvas = document.getElementById("micanvas");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
|
||||
debugConsole.value=canvasData;
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?echo $ancho ?>')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
/// render(img.src);
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
//maxWidth: result.width(),
|
||||
maxWidth: <?echo $ancho ?>,
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
// displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<!-- <script src="js/demo.js"></script> -->
|
||||
</div>
|
@ -1,207 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
|
||||
<!-- <link rel="stylesheet" href="css/demo.css"> -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: 800px;
|
||||
}
|
||||
.pin {
|
||||
text-align: center;
|
||||
border: solid 1px red;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='container'>
|
||||
<div class='fileUpload btn btn-primary '>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
<input type="hidden" id='identificador' name='identificador'>
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = 800;
|
||||
micanvas.width = ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<script src="js/demo.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,207 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
|
||||
<!-- <link rel="stylesheet" href="css/demo.css"> -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: 800px;
|
||||
}
|
||||
.pin {
|
||||
text-align: center;
|
||||
border: solid 1px red;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='container'>
|
||||
<div class='fileUpload btn btn-primary '>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
<input type="hidden" id='identificador' name='identificador'>
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = 800;
|
||||
micanvas.width = ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<script src="js/demo.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,436 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/brigadistas/images/logos/a.png";
|
||||
$tags[] = "milfs/addon/brigadistas/images/logos/b.png";
|
||||
$tags[] = "milfs/addon/brigadistas/images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td><a href='#medio' class='' onclick=\" document.getElementById('marca').src='$valor' \" >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr>
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
|
||||
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cabin" type="text/css"/>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: 'CabinRegular';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
.fa{
|
||||
font-size:60px;
|
||||
}
|
||||
|
||||
#downlink_hidden , #fieldset_General , #canvas_ed , #original{
|
||||
display:none;
|
||||
}
|
||||
#body{
|
||||
background-color: white;
|
||||
|
||||
}
|
||||
#aviso{
|
||||
background-color: gray;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div id='aviso'>
|
||||
<div id ="body" class="container" >
|
||||
|
||||
<div id="div_brigadistas" class="">
|
||||
<span class='btn btn-primary btn-block' > <!-- <i class="fa fa-picture-o"></i> --> <span class='fa' > Elige un Logo </span></span>
|
||||
<?php echo $imagen; ?>
|
||||
<a name="medio"></a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='fileUpload btn btn-primary btn-block'>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Sube una imágen</span>
|
||||
<input class='upload' type="file" id="files" name="files[]" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a name="abajo"></a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='container-fluid'>
|
||||
<table style="" class="table text-center table-responsive">
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- editor -->
|
||||
|
||||
<div class='container-fluid'>
|
||||
|
||||
|
||||
<div style="background-color:; " >
|
||||
<img class="center-block" style='' id="marca" name="marca">
|
||||
|
||||
<div id="list" style=" "></div>
|
||||
<img id='image_output2' name='image_output2' src="" class="" />
|
||||
|
||||
<div id='div_canvas' style='display: none'> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<form id='formulario_brigadistas' name='formulario_brigadistas' >
|
||||
<input type='hidden' id="debugConsole" name="debugConsole" >
|
||||
<input type='hidden' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); saveViaAJAX(); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- fin aviso -->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
$("body").append(canvas);
|
||||
};
|
||||
|
||||
function convertImageToCanvas(image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.getContext("2d").drawImage(image, 0, 0);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function convertCanvasToImage(canvas) {
|
||||
var image = new Image();
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
return image;
|
||||
}
|
||||
|
||||
function saveViaAJAX()
|
||||
{
|
||||
|
||||
$(document).ready(function() {
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvasOld = document.getElementById("holamundo");
|
||||
// canvasOld.holamundo.removeChild(canvasOld);
|
||||
document.getElementById("div_canvas").innerHTML=""
|
||||
var canvas = document.createElement("canvas");
|
||||
div = document.getElementById('div_canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.id = "holamundo";
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
div.appendChild(canvas);
|
||||
};
|
||||
|
||||
$('.watermark').each(convertImageToCanvas);
|
||||
|
||||
});
|
||||
|
||||
var testCanvas = document.getElementById("holamundo");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
debugConsole.value=canvasData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function archivo(evt) {
|
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Obtenemos la imagen del campo "file".
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
//Solo admitimos imágenes.
|
||||
if (!f.type.match('image.*')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = (function(theFile) {
|
||||
return function(e) {
|
||||
// Insertamos la imagen
|
||||
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
document.getElementById("list").innerHTML = ['<img style="width:<?php echo $ancho; ?>px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
};
|
||||
})(f);
|
||||
|
||||
reader.readAsDataURL(f);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('files').addEventListener('change', archivo, false);
|
||||
|
||||
/* marca */
|
||||
|
||||
|
||||
(function(w){
|
||||
var wm = (function(w){
|
||||
var doc = w.document,
|
||||
gcanvas = {},
|
||||
gctx = {},
|
||||
imgQueue = [],
|
||||
className = "watermark",
|
||||
watermark = false,
|
||||
watermarkPosition = "bottom-right",
|
||||
watermarkPath = "<?php echo $tags['1']; ?>"+(+(new Date())),
|
||||
opacity = (255/(100/50)), // 50%
|
||||
initCanvas = function(){
|
||||
gcanvas = doc.createElement("canvas");
|
||||
gcanvas.style.cssText = "display:none;";
|
||||
gctx = gcanvas.getContext("2d");
|
||||
doc.body.appendChild(gcanvas);
|
||||
},
|
||||
initWatermark = function(){
|
||||
watermark = new Image();
|
||||
watermark.src = "";
|
||||
watermark.src = watermarkPath;
|
||||
|
||||
if(opacity != 255){
|
||||
if(!watermark.complete)
|
||||
watermark.onload = function(){
|
||||
applyTransparency();
|
||||
}
|
||||
else
|
||||
applyTransparency();
|
||||
|
||||
|
||||
}else{
|
||||
applyWatermarks();
|
||||
}
|
||||
|
||||
},
|
||||
// function for applying transparency to the watermark
|
||||
applyTransparency = function(){
|
||||
var w = watermark.width || watermark.offsetWidth,
|
||||
h = watermark.height || watermark.offsetHeight;
|
||||
setCanvasSize(w, h);
|
||||
gctx.drawImage(watermark, 0, 0);
|
||||
|
||||
var image = gctx.getImageData(0, 0, w, h);
|
||||
var imageData = image.data,
|
||||
length = imageData.length;
|
||||
for(var i=3; i < length; i+=4){
|
||||
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
|
||||
}
|
||||
image.data = imageData;
|
||||
gctx.putImageData(image, 0, 0);
|
||||
watermark.onload = null;
|
||||
watermark.src = "";
|
||||
watermark.src = gcanvas.toDataURL();
|
||||
// assign img attributes to the transparent watermark
|
||||
// because browsers recalculation doesn't work as fast as needed
|
||||
watermark.width = w;
|
||||
watermark.height = h;
|
||||
|
||||
applyWatermarks();
|
||||
},
|
||||
configure = function(config){
|
||||
if(config["watermark"])
|
||||
watermark = config["watermark"];
|
||||
if(config["path"])
|
||||
watermarkPath = config["path"];
|
||||
if(config["position"])
|
||||
watermarkPosition = config["position"];
|
||||
if(config["opacity"])
|
||||
opacity = (255/(100/config["opacity"]));
|
||||
if(config["className"])
|
||||
className = config["className"];
|
||||
|
||||
initCanvas();
|
||||
initWatermark();
|
||||
}
|
||||
setCanvasSize = function(w, h){
|
||||
gcanvas.width = w;
|
||||
gcanvas.height = h;
|
||||
},
|
||||
applyWatermark = function(img){
|
||||
/*
|
||||
var f = image.height / image.width;
|
||||
var newHeight = canvas.width * f;
|
||||
|
||||
*/
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?php echo $ancho; ?>;
|
||||
//var alto_orginal = img.height;
|
||||
//var alto = (alto_original * proporcion);
|
||||
//alert("hola pro"+alto);
|
||||
gcanvas.width = ancho;// || img.offsetWidth;
|
||||
//gcanvas.width = img.width || img.offsetWidth;
|
||||
//gcanvas.height = img.height || img.offsetHeight;
|
||||
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
|
||||
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
|
||||
var position = watermarkPosition,
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(position.indexOf("top")!=-1)
|
||||
y = 20;
|
||||
else if(position.indexOf("middle")!=-1)
|
||||
y = (gcanvas.height -watermark.height)/2;
|
||||
else
|
||||
y = gcanvas.height-watermark.height-20;
|
||||
|
||||
if(position.indexOf("left")!=-1)
|
||||
x = 20;
|
||||
else if(position.indexOf("center")!=-1)
|
||||
x = (gcanvas.width - watermark.width) /2;
|
||||
else
|
||||
x = gcanvas.width-watermark.width-20;
|
||||
|
||||
|
||||
gctx.drawImage(watermark, x, y);
|
||||
img.onload = null;
|
||||
|
||||
img.src = gcanvas.toDataURL();
|
||||
|
||||
},
|
||||
applyWatermarks = function(){
|
||||
setTimeout(function(){
|
||||
var els = doc.getElementsByClassName(className),
|
||||
len = els.length;
|
||||
while(len--){
|
||||
var img = els[len];
|
||||
if(img.tagName.toUpperCase() != "IMG")
|
||||
continue;
|
||||
|
||||
if(!img.complete){
|
||||
img.onload = function(){
|
||||
applyWatermark(this);
|
||||
};
|
||||
}else{
|
||||
applyWatermark(img);
|
||||
}
|
||||
}
|
||||
},10);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
init: function(config){
|
||||
configure(config);
|
||||
}
|
||||
};
|
||||
})(w);
|
||||
w.wmark = wm;
|
||||
})(window);
|
||||
/* marca */
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function marcar(position){
|
||||
|
||||
|
||||
var position = position;
|
||||
|
||||
var original = document.getElementById('image_output2').src ;
|
||||
var marca = document.getElementById('marca').src ;
|
||||
document.getElementById('image_output').src = original ;
|
||||
wmark.init({
|
||||
|
||||
/* config goes here */
|
||||
|
||||
"position": position, // default "bottom-right"
|
||||
|
||||
"opacity": 100, // default 50
|
||||
|
||||
"className": "watermark", // default "watermark"
|
||||
|
||||
"path": marca
|
||||
// "path": "../milfs/addon/machitroll/images/054843d530f3c83fcdbd55e688d874ec.png"
|
||||
|
||||
});
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
|
||||
//window.setTimeout("saveViaAJAX()", 3000); ///
|
||||
//saveViaAJAX(); ///
|
||||
//xajax_wait('aviso','Subiendo imágen');
|
||||
//window.setTimeout("xajax_machitroll_grabar_imagen(document.getElementById('debugConsole').value,"+identificador+")", 5000);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -1,84 +0,0 @@
|
||||
<?php
|
||||
function brigadiastas_grabar_imagen($data,$identificador) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$control = md5("$identificador");
|
||||
//$form_id = $fomulario["formulario_id"];
|
||||
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
|
||||
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
return $respuesta;
|
||||
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar_imagen");
|
||||
|
||||
function brigadistas_grabar($formulario) {
|
||||
|
||||
$identificador = $formulario['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $formulario['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#BrigadaDigital");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
||||
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
|
||||
</span>
|
||||
<a href='?set=$formulario[formulario_id]&embebido'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $formulario['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$formulario[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
|
||||
include_once("librerias/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
|
||||
foreach($formulario as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultado = "$preview ";
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar");
|
||||
|
||||
|
||||
|
||||
?>
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 38 KiB |
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
require("machitroll/funciones/funciones.php");
|
||||
require("logis/funciones/funciones.php");
|
||||
require("tuitealo/funciones/funciones.php");
|
||||
//require("dummy/funciones/funciones.php");
|
||||
?>
|
@ -1,510 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "500";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/logis/images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<div>
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px important!;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: <?echo $ancho ?>px;
|
||||
}
|
||||
body{
|
||||
background-color:white !important;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.pin {
|
||||
text-align: center;
|
||||
/*border: solid 1px red;*/
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
.ing-touch{
|
||||
border: solid 1px red;
|
||||
width:20% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class='container' style='backgroun-color:white;' >
|
||||
<div class='fileUpload btn btn-primary center-block'>
|
||||
<span><h1><i class="fa fa-camera"></i></h1></span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
|
||||
</div>
|
||||
<div class="row " style="position:relative">
|
||||
|
||||
|
||||
<form id='formulario_brigadistas' name='formulario_brigadistas' >
|
||||
<input class='form-control' type='' id="debugConsole" name="debugConsole" >
|
||||
<input type='' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div id='aviso'>Aviso</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas'))">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?echo $ancho ?>px')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
displayExifData = function (exif) {
|
||||
var thumbnail = exif.get('Thumbnail'),
|
||||
tags = exif.getAll(),
|
||||
table = exifNode.find('table').empty(),
|
||||
row = $('<tr></tr>'),
|
||||
cell = $('<td></td>'),
|
||||
prop;
|
||||
if (thumbnail) {
|
||||
thumbNode.empty();
|
||||
loadImage(thumbnail, function (img) {
|
||||
thumbNode.append(img).show();
|
||||
}, {orientation: exif.get('Orientation')});
|
||||
}
|
||||
for (prop in tags) {
|
||||
if (tags.hasOwnProperty(prop)) {
|
||||
table.append(
|
||||
row.clone()
|
||||
.append(cell.clone().text(prop))
|
||||
.append(cell.clone().text(tags[prop]))
|
||||
);
|
||||
}
|
||||
}
|
||||
exifNode.show();
|
||||
},
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
maxWidth: result.width(),
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?echo $ancho ?>;
|
||||
micanvas.width =ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
var testCanvas = document.getElementById("micanvas");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
|
||||
debugConsole.value=canvasData;
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?echo $ancho ?>')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
displayExifData = function (exif) {
|
||||
var thumbnail = exif.get('Thumbnail'),
|
||||
tags = exif.getAll(),
|
||||
table = exifNode.find('table').empty(),
|
||||
row = $('<tr></tr>'),
|
||||
cell = $('<td></td>'),
|
||||
prop;
|
||||
if (thumbnail) {
|
||||
thumbNode.empty();
|
||||
loadImage(thumbnail, function (img) {
|
||||
thumbNode.append(img).show();
|
||||
}, {orientation: exif.get('Orientation')});
|
||||
}
|
||||
for (prop in tags) {
|
||||
if (tags.hasOwnProperty(prop)) {
|
||||
table.append(
|
||||
row.clone()
|
||||
.append(cell.clone().text(prop))
|
||||
.append(cell.clone().text(tags[prop]))
|
||||
);
|
||||
}
|
||||
}
|
||||
exifNode.show();
|
||||
},
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
maxWidth: result.width(),
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<!-- <script src="js/demo.js"></script> -->
|
||||
</div>
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
function brigadistas_grabar_imagen($data,$identificador) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$control = md5("$identificador");
|
||||
//$form_id = $fomulario["formulario_id"];
|
||||
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
|
||||
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
return $respuesta;
|
||||
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar_imagen");
|
||||
|
||||
function brigadistas_grabar($formulario) {
|
||||
|
||||
$identificador = $formulario['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $formulario['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#BrigadaDigital");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
|
||||
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
|
||||
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $formulario['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$formulario[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
|
||||
include_once("librerias/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
|
||||
foreach($formulario as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysqli_real_escape_string($link, $v )."')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$twitter = $formulario['498'][0];
|
||||
$_SESSION['logis'] = "$control";
|
||||
$_SESSION['mensaje'] = "$twitter";
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
||||
<h2 class='text-center'>$twitter<h2>
|
||||
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a target= 'twitter' href ='milfs/addon/logis/funciones/twitter/tuitear.php' ><i class='fa fa-twitter'></i></a>
|
||||
</span>
|
||||
<a href='S58'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> Ver</span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> Actualizar</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
$resultado = "$preview ";
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("brigadistas_grabar");
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Use to autoload needed classes without Composer.
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(function ($class) {
|
||||
|
||||
// project-specific namespace prefix
|
||||
$prefix = 'Abraham\\TwitterOAuth\\';
|
||||
|
||||
// base directory for the namespace prefix
|
||||
$base_dir = __DIR__ . '/src/';
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
// no, move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $len);
|
||||
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
// if the file exists, require it
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
Before Width: | Height: | Size: 38 KiB |
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
|
||||
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
|
||||
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/toa/hola.php');
|
||||
|
||||
?>
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
/*
|
||||
define('CONSUMER_KEY', getenv('wMtivKDSAgZmkP7EZhYcfw'));
|
||||
define('CONSUMER_SECRET', getenv('AvWbHfjuSJkZYhkxsU8ojsDpNtvapBoiRUzwF3OAvbo'));
|
||||
define('OAUTH_CALLBACK', getenv('http://datos.labmde.org/milfs/toa/hola.php'));
|
||||
*/
|
||||
define('CONSUMER_KEY', 'QS1JHXs7OgJcFArJmMv117JEn');
|
||||
define('CONSUMER_SECRET', 'NoO1FUXHmTB74HUrnDbcs64XgZoroBkaPav8w0FgbK3ZYSU9PZ');
|
||||
define('OAUTH_CALLBACK', 'http://datos.labmde.org/milfs/addon/logis/funciones/twitter/hola.php');
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
|
||||
//print $connection; //print connection contents
|
||||
//$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
|
||||
$request_token = $connection->oauth('oauth/request_token');
|
||||
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
$user = $connection->get("account/verify_credentials");
|
||||
//print $user->screen_name;
|
||||
print_r($user);
|
||||
// Post Update
|
||||
|
||||
$content = $connection->post('statuses/update', array('status' => 'Bonito dia'));
|
||||
print_r( $content);
|
||||
print_r($url);
|
||||
|
||||
|
||||
//print_r($request_token); //print connection contentsa
|
||||
|
||||
|
||||
?>
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
require_once('config.php');
|
||||
|
||||
/* Crear un objeto TwitteroAuth con las credenciales de la aplicacion y el token temporal */
|
||||
//$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
|
||||
|
||||
/* Solicitar a twitter el token de acceso */
|
||||
//$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
|
||||
$access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
|
||||
|
||||
|
||||
/* Guardar el token de acceso. Normalmente, este token se guardará también en una base
|
||||
de datos para volver a ser utilizado en otras ocasiones. */
|
||||
$_SESSION['access_token'] = $access_token;
|
||||
|
||||
/* Eliminar el token temporal de solicitud */
|
||||
unset($_SESSION['oauth_token']);
|
||||
unset($_SESSION['oauth_token_secret']);
|
||||
|
||||
/* Si todo va bien, presentar al usuario la página principal "index.php" del servicio */
|
||||
//if (200 == $connection->http_code) {
|
||||
/* El usuario ha sido verificado */
|
||||
$_SESSION['status'] = 'verified';
|
||||
echo send_tweet($access_token);
|
||||
//}
|
||||
function base64_encode_image ($filename=string,$filetype=string) {
|
||||
if ($filename) {
|
||||
$imgbinary = fread(fopen($filename, "r"), filesize($filename));
|
||||
return base64_encode($imgbinary);
|
||||
}
|
||||
}
|
||||
|
||||
function send_tweet($access_token) {
|
||||
$tweet = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
|
||||
$access_token['oauth_token'], $access_token['oauth_token_secret']);
|
||||
$nombre= $_SESSION['logis'].".png";
|
||||
$nombre = "$_SESSION[path_images_secure]/600/$nombre";
|
||||
|
||||
$media1 = $tweet->upload('media/upload', array('media' => "$nombre"));
|
||||
$parameters = array('status' =>"$_SESSION[mensaje] #BrigadaDigital #CD2015 http://datos.labmde.org/jlogis",'media_ids' => implode(',', array($media1->media_id_string)),
|
||||
);
|
||||
|
||||
$result = $tweet-> post('statuses/update', $parameters);
|
||||
/*$image = "$nombre";
|
||||
$base64 = base64_encode_image (''.$image,'png');
|
||||
$result = $tweet-> post('account/update_profile_image', array('image' => $base64.';type=image/jpg;filename='.$image));
|
||||
*/
|
||||
// $message = "Bonito dia $nombre";
|
||||
// $tweet->post('statuses/update', array('status' => "$message"));
|
||||
//
|
||||
}
|
||||
|
||||
header('Location: https://twitter.com/hashtag/CD2015');
|
||||
|
||||
// header('Location: ./index.php');
|
||||
//} else {
|
||||
//header('Location: ./clearsessions.php');
|
||||
//
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* Handle setting and storing config for TwitterOAuth.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/** @var int How long to wait for a response from the API */
|
||||
protected $timeout = 5;
|
||||
/** @var int how long to wait while connecting to the API */
|
||||
protected $connectionTimeout = 5;
|
||||
/**
|
||||
* Decode JSON Response as associative Array
|
||||
*
|
||||
* @see http://php.net/manual/en/function.json-decode.php
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $decodeJsonAsArray = false;
|
||||
/** @var string User-Agent header */
|
||||
protected $userAgent = 'TwitterOAuth (+https://twitteroauth.com)';
|
||||
/** @var array Store proxy connection details */
|
||||
protected $proxy = [];
|
||||
|
||||
/**
|
||||
* Set the connection and response timeouts.
|
||||
*
|
||||
* @param int $connectionTimeout
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function setTimeouts($connectionTimeout, $timeout)
|
||||
{
|
||||
$this->connectionTimeout = (int)$connectionTimeout;
|
||||
$this->timeout = (int)$timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setDecodeJsonAsArray($value)
|
||||
{
|
||||
$this->decodeJsonAsArray = (bool)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userAgent
|
||||
*/
|
||||
public function setUserAgent($userAgent)
|
||||
{
|
||||
$this->userAgent = (string)$userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $proxy
|
||||
*/
|
||||
public function setProxy(array $proxy)
|
||||
{
|
||||
$this->proxy = $proxy;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Consumer
|
||||
{
|
||||
/** @var string */
|
||||
public $key;
|
||||
/** @var string */
|
||||
public $secret;
|
||||
/** @var string|null */
|
||||
public $callbackUrl;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string $secret
|
||||
* @param null $callbackUrl
|
||||
*/
|
||||
public function __construct($key, $secret, $callbackUrl = null)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->secret = $secret;
|
||||
$this->callbackUrl = $callbackUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "Consumer[key=$this->key,secret=$this->secret]";
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
|
||||
* where the Signature Base String is the text and the key is the concatenated values (each first
|
||||
* encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
|
||||
* character (ASCII code 38) even if empty.
|
||||
* - Chapter 9.2 ("HMAC-SHA1")
|
||||
*/
|
||||
class HmacSha1 extends SignatureMethod
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "HMAC-SHA1";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildSignature(Request $request, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
$signatureBase = $request->getSignatureBaseString();
|
||||
|
||||
$parts = [$consumer->secret, null !== $token ? $token->secret : ""];
|
||||
|
||||
$parts = Util::urlencodeRfc3986($parts);
|
||||
$key = implode('&', $parts);
|
||||
|
||||
return base64_encode(hash_hmac('sha1', $signatureBase, $key, true));
|
||||
}
|
||||
}
|
@ -1,254 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Request
|
||||
{
|
||||
protected $parameters;
|
||||
protected $httpMethod;
|
||||
protected $httpUrl;
|
||||
public static $version = '1.0';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $httpMethod
|
||||
* @param string $httpUrl
|
||||
* @param array|null $parameters
|
||||
*/
|
||||
public function __construct($httpMethod, $httpUrl, array $parameters = [])
|
||||
{
|
||||
$parameters = array_merge(Util::parseParameters(parse_url($httpUrl, PHP_URL_QUERY)), $parameters);
|
||||
$this->parameters = $parameters;
|
||||
$this->httpMethod = $httpMethod;
|
||||
$this->httpUrl = $httpUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* pretty much a helper function to set up the request
|
||||
*
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
* @param string $httpMethod
|
||||
* @param string $httpUrl
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Request
|
||||
*/
|
||||
public static function fromConsumerAndToken(
|
||||
Consumer $consumer,
|
||||
Token $token = null,
|
||||
$httpMethod,
|
||||
$httpUrl,
|
||||
array $parameters = []
|
||||
) {
|
||||
$defaults = [
|
||||
"oauth_version" => Request::$version,
|
||||
"oauth_nonce" => Request::generateNonce(),
|
||||
"oauth_timestamp" => time(),
|
||||
"oauth_consumer_key" => $consumer->key
|
||||
];
|
||||
if (null !== $token) {
|
||||
$defaults['oauth_token'] = $token->key;
|
||||
}
|
||||
|
||||
$parameters = array_merge($defaults, $parameters);
|
||||
|
||||
return new Request($httpMethod, $httpUrl, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function setParameter($name, $value)
|
||||
{
|
||||
$this->parameters[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParameter($name)
|
||||
{
|
||||
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*/
|
||||
public function removeParameter($name)
|
||||
{
|
||||
unset($this->parameters[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The request parameters, sorted and concatenated into a normalized string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSignableParameters()
|
||||
{
|
||||
// Grab all parameters
|
||||
$params = $this->parameters;
|
||||
|
||||
// Remove oauth_signature if present
|
||||
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
|
||||
if (isset($params['oauth_signature'])) {
|
||||
unset($params['oauth_signature']);
|
||||
}
|
||||
|
||||
return Util::buildHttpQuery($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base string of this request
|
||||
*
|
||||
* The base string defined as the method, the url
|
||||
* and the parameters (normalized), each urlencoded
|
||||
* and the concated with &.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSignatureBaseString()
|
||||
{
|
||||
$parts = [
|
||||
$this->getNormalizedHttpMethod(),
|
||||
$this->getNormalizedHttpUrl(),
|
||||
$this->getSignableParameters()
|
||||
];
|
||||
|
||||
$parts = Util::urlencodeRfc3986($parts);
|
||||
|
||||
return implode('&', $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP Method in uppercase
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNormalizedHttpMethod()
|
||||
{
|
||||
return strtoupper($this->httpMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the url and rebuilds it to be
|
||||
* scheme://host/path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNormalizedHttpUrl()
|
||||
{
|
||||
$parts = parse_url($this->httpUrl);
|
||||
|
||||
$scheme = $parts['scheme'];
|
||||
$host = strtolower($parts['host']);
|
||||
$path = $parts['path'];
|
||||
|
||||
return "$scheme://$host$path";
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a url usable for a GET request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toUrl()
|
||||
{
|
||||
$postData = $this->toPostdata();
|
||||
$out = $this->getNormalizedHttpUrl();
|
||||
if ($postData) {
|
||||
$out .= '?' . $postData;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the data one would send in a POST request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toPostdata()
|
||||
{
|
||||
return Util::buildHttpQuery($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Authorization: header
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
public function toHeader()
|
||||
{
|
||||
$first = true;
|
||||
$out = 'Authorization: OAuth';
|
||||
foreach ($this->parameters as $k => $v) {
|
||||
if (substr($k, 0, 5) != "oauth") {
|
||||
continue;
|
||||
}
|
||||
if (is_array($v)) {
|
||||
throw new TwitterOAuthException('Arrays not supported in headers');
|
||||
}
|
||||
$out .= ($first) ? ' ' : ', ';
|
||||
$out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
|
||||
$first = false;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SignatureMethod $signatureMethod
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*/
|
||||
public function signRequest(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
$this->setParameter("oauth_signature_method", $signatureMethod->getName());
|
||||
$signature = $this->buildSignature($signatureMethod, $consumer, $token);
|
||||
$this->setParameter("oauth_signature", $signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SignatureMethod $signatureMethod
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildSignature(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
|
||||
{
|
||||
return $signatureMethod->buildSignature($this, $consumer, $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function generateNonce()
|
||||
{
|
||||
return md5(microtime() . mt_rand());
|
||||
}
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* The result of the most recent API request.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class Response
|
||||
{
|
||||
/** @var string|null API path from the most recent request */
|
||||
private $apiPath;
|
||||
/** @var int HTTP status code from the most recent request */
|
||||
private $httpCode = 0;
|
||||
/** @var array HTTP headers from the most recent request */
|
||||
private $headers = [];
|
||||
/** @var array|object Response body from the most recent request */
|
||||
private $body = [];
|
||||
/** @var array HTTP headers from the most recent request that start with X */
|
||||
private $xHeaders = [];
|
||||
|
||||
/**
|
||||
* @param string $apiPath
|
||||
*/
|
||||
public function setApiPath($apiPath)
|
||||
{
|
||||
$this->apiPath = $apiPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApiPath()
|
||||
{
|
||||
return $this->apiPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|object $body
|
||||
*/
|
||||
public function setBody($body)
|
||||
{
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|object|string
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $httpCode
|
||||
*/
|
||||
public function setHttpCode($httpCode)
|
||||
{
|
||||
$this->httpCode = $httpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHttpCode()
|
||||
{
|
||||
return $this->httpCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
*/
|
||||
public function setHeaders($headers)
|
||||
{
|
||||
foreach ($headers as $key => $value) {
|
||||
if (substr($key, 0, 1) == 'x') {
|
||||
$this->xHeaders[$key] = $value;
|
||||
}
|
||||
}
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getsHeaders()
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $xHeaders
|
||||
*/
|
||||
public function setXHeaders($xHeaders)
|
||||
{
|
||||
$this->xHeaders = $xHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getXHeaders()
|
||||
{
|
||||
return $this->xHeaders;
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* A class for implementing a Signature Method
|
||||
* See section 9 ("Signing Requests") in the spec
|
||||
*/
|
||||
abstract class SignatureMethod
|
||||
{
|
||||
/**
|
||||
* Needs to return the name of the Signature Method (ie HMAC-SHA1)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getName();
|
||||
|
||||
/**
|
||||
* Build up the signature
|
||||
* NOTE: The output of this function MUST NOT be urlencoded.
|
||||
* the encoding is handled in OAuthRequest when the final
|
||||
* request is serialized
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function buildSignature(Request $request, Consumer $consumer, Token $token = null);
|
||||
|
||||
/**
|
||||
* Verifies that a given signature is correct
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Consumer $consumer
|
||||
* @param Token $token
|
||||
* @param string $signature
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
|
||||
{
|
||||
$built = $this->buildSignature($request, $consumer, $token);
|
||||
|
||||
// Check for zero length, although unlikely here
|
||||
if (strlen($built) == 0 || strlen($signature) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($built) != strlen($signature)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Avoid a timing leak with a (hopefully) time insensitive compare
|
||||
$result = 0;
|
||||
for ($i = 0; $i < strlen($signature); $i++) {
|
||||
$result |= ord($built{$i}) ^ ord($signature{$i});
|
||||
}
|
||||
|
||||
return $result == 0;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Token
|
||||
{
|
||||
/** @var string */
|
||||
public $key;
|
||||
/** @var string */
|
||||
public $secret;
|
||||
|
||||
/**
|
||||
* @param string $key The OAuth Token
|
||||
* @param string $secret The OAuth Token Secret
|
||||
*/
|
||||
public function __construct($key, $secret)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->secret = $secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the basic string serialization of a token that a server
|
||||
* would respond to request_token and access_token calls with
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf("oauth_token=%s&oauth_token_secret=%s",
|
||||
Util::urlencodeRfc3986($this->key),
|
||||
Util::urlencodeRfc3986($this->secret)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,448 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The most popular PHP library for use with the Twitter OAuth REST API.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
use Abraham\TwitterOAuth\Util\JsonDecoder;
|
||||
|
||||
/**
|
||||
* TwitterOAuth class for interacting with the Twitter API.
|
||||
*
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class TwitterOAuth extends Config
|
||||
{
|
||||
const API_VERSION = '1.1';
|
||||
const API_HOST = 'https://api.twitter.com';
|
||||
const UPLOAD_HOST = 'https://upload.twitter.com';
|
||||
const UPLOAD_CHUNK = 40960; // 1024 * 40
|
||||
|
||||
/** @var Response details about the result of the last request */
|
||||
private $response;
|
||||
/** @var string|null Application bearer token */
|
||||
private $bearer;
|
||||
/** @var Consumer Twitter application details */
|
||||
private $consumer;
|
||||
/** @var Token|null User access token details */
|
||||
private $token;
|
||||
/** @var HmacSha1 OAuth 1 signature type used by Twitter */
|
||||
private $signatureMethod;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $consumerKey The Application Consumer Key
|
||||
* @param string $consumerSecret The Application Consumer Secret
|
||||
* @param string|null $oauthToken The Client Token (optional)
|
||||
* @param string|null $oauthTokenSecret The Client Token Secret (optional)
|
||||
*/
|
||||
public function __construct($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$this->signatureMethod = new HmacSha1();
|
||||
$this->consumer = new Consumer($consumerKey, $consumerSecret);
|
||||
if (!empty($oauthToken) && !empty($oauthTokenSecret)) {
|
||||
$this->token = new Token($oauthToken, $oauthTokenSecret);
|
||||
}
|
||||
if (empty($oauthToken) && !empty($oauthTokenSecret)) {
|
||||
$this->bearer = $oauthTokenSecret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oauthToken
|
||||
* @param string $oauthTokenSecret
|
||||
*/
|
||||
public function setOauthToken($oauthToken, $oauthTokenSecret)
|
||||
{
|
||||
$this->token = new Token($oauthToken, $oauthTokenSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastApiPath()
|
||||
{
|
||||
return $this->response->getApiPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLastHttpCode()
|
||||
{
|
||||
return $this->response->getHttpCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLastXHeaders()
|
||||
{
|
||||
return $this->response->getXHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|object|null
|
||||
*/
|
||||
public function getLastBody()
|
||||
{
|
||||
return $this->response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the last response cache.
|
||||
*/
|
||||
public function resetLastResponse()
|
||||
{
|
||||
$this->response = new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make URLs for user browser navigation.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function url($path, array $parameters)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$query = http_build_query($parameters);
|
||||
return sprintf('%s/%s?%s', self::API_HOST, $path, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make /oauth/* requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
public function oauth($path, array $parameters = [])
|
||||
{
|
||||
$response = [];
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$url = sprintf('%s/%s', self::API_HOST, $path);
|
||||
$result = $this->oAuthRequest($url, 'POST', $parameters);
|
||||
|
||||
if ($this->getLastHttpCode() != 200) {
|
||||
throw new TwitterOAuthException($result);
|
||||
}
|
||||
|
||||
parse_str($result, $response);
|
||||
$this->response->setBody($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make /oauth2/* requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function oauth2($path, array $parameters = [])
|
||||
{
|
||||
$method = 'POST';
|
||||
$this->resetLastResponse();
|
||||
$this->response->setApiPath($path);
|
||||
$url = sprintf('%s/%s', self::API_HOST, $path);
|
||||
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
|
||||
$authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
|
||||
$result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
|
||||
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
|
||||
$this->response->setBody($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make GET requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function get($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('GET', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make POST requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function post($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('POST', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make DELETE requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function delete($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('DELETE', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make PUT requests to the API.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function put($path, array $parameters = [])
|
||||
{
|
||||
return $this->http('PUT', self::API_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload media to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
* @param boolean $chunked
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public function upload($path, array $parameters = [], $chunked = false)
|
||||
{
|
||||
if ($chunked) {
|
||||
return $this->uploadMediaChunked($path, $parameters);
|
||||
} else {
|
||||
return $this->uploadMediaNotChunked($path, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private method to upload media (not chunked) to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function uploadMediaNotChunked($path, $parameters)
|
||||
{
|
||||
$file = file_get_contents($parameters['media']);
|
||||
$base = base64_encode($file);
|
||||
$parameters['media'] = $base;
|
||||
return $this->http('POST', self::UPLOAD_HOST, $path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private method to upload media (chunked) to upload.twitter.com.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function uploadMediaChunked($path, $parameters)
|
||||
{
|
||||
// Init
|
||||
$init = $this->http('POST', self::UPLOAD_HOST, $path, [
|
||||
'command' => 'INIT',
|
||||
'media_type' => $parameters['media_type'],
|
||||
'total_bytes' => filesize($parameters['media'])
|
||||
]);
|
||||
// Append
|
||||
$segment_index = 0;
|
||||
$media = fopen($parameters['media'], 'rb');
|
||||
while (!feof($media))
|
||||
{
|
||||
$this->http('POST', self::UPLOAD_HOST, 'media/upload', [
|
||||
'command' => 'APPEND',
|
||||
'media_id' => $init->media_id_string,
|
||||
'segment_index' => $segment_index++,
|
||||
'media_data' => base64_encode(fread($media, self::UPLOAD_CHUNK))
|
||||
]);
|
||||
}
|
||||
fclose($media);
|
||||
// Finalize
|
||||
$finalize = $this->http('POST', self::UPLOAD_HOST, 'media/upload', [
|
||||
'command' => 'FINALIZE',
|
||||
'media_id' => $init->media_id_string
|
||||
]);
|
||||
return $finalize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
private function http($method, $host, $path, array $parameters)
|
||||
{
|
||||
$this->resetLastResponse();
|
||||
$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
|
||||
$this->response->setApiPath($path);
|
||||
$result = $this->oAuthRequest($url, $method, $parameters);
|
||||
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
|
||||
$this->response->setBody($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format and sign an OAuth / API request
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
private function oAuthRequest($url, $method, array $parameters)
|
||||
{
|
||||
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
|
||||
if (array_key_exists('oauth_callback', $parameters)) {
|
||||
// Twitter doesn't like oauth_callback as a parameter.
|
||||
unset($parameters['oauth_callback']);
|
||||
}
|
||||
if ($this->bearer === null) {
|
||||
$request->signRequest($this->signatureMethod, $this->consumer, $this->token);
|
||||
$authorization = $request->toHeader();
|
||||
} else {
|
||||
$authorization = 'Authorization: Bearer ' . $this->bearer;
|
||||
}
|
||||
return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an HTTP request
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param string $authorization
|
||||
* @param array $postfields
|
||||
*
|
||||
* @return string
|
||||
* @throws TwitterOAuthException
|
||||
*/
|
||||
private function request($url, $method, $authorization, $postfields)
|
||||
{
|
||||
/* Curl settings */
|
||||
$options = [
|
||||
// CURLOPT_VERBOSE => true,
|
||||
CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
|
||||
CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_HTTPHEADER => ['Accept: application/json', $authorization, 'Expect:'],
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYHOST => 2,
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
CURLOPT_TIMEOUT => $this->timeout,
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_USERAGENT => $this->userAgent,
|
||||
CURLOPT_ENCODING => 'gzip',
|
||||
];
|
||||
|
||||
if (!empty($this->proxy)) {
|
||||
$options[CURLOPT_PROXY] = $this->proxy['CURLOPT_PROXY'];
|
||||
$options[CURLOPT_PROXYUSERPWD] = $this->proxy['CURLOPT_PROXYUSERPWD'];
|
||||
$options[CURLOPT_PROXYPORT] = $this->proxy['CURLOPT_PROXYPORT'];
|
||||
$options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC;
|
||||
$options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
|
||||
}
|
||||
|
||||
switch ($method) {
|
||||
case 'GET':
|
||||
break;
|
||||
case 'POST':
|
||||
$options[CURLOPT_POST] = true;
|
||||
$options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
|
||||
break;
|
||||
case 'DELETE':
|
||||
$options[CURLOPT_CUSTOMREQUEST] = 'DELETE';
|
||||
break;
|
||||
case 'PUT':
|
||||
$options[CURLOPT_CUSTOMREQUEST] = 'PUT';
|
||||
break;
|
||||
}
|
||||
|
||||
if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields)) {
|
||||
$options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
|
||||
}
|
||||
|
||||
|
||||
$curlHandle = curl_init();
|
||||
curl_setopt_array($curlHandle, $options);
|
||||
$response = curl_exec($curlHandle);
|
||||
|
||||
// Throw exceptions on cURL errors.
|
||||
if (curl_errno($curlHandle) > 0) {
|
||||
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
|
||||
}
|
||||
|
||||
$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
|
||||
$parts = explode("\r\n\r\n", $response);
|
||||
$responseBody = array_pop($parts);
|
||||
$responseHeader = array_pop($parts);
|
||||
$this->response->setHeaders($this->parseHeaders($responseHeader));
|
||||
|
||||
curl_close($curlHandle);
|
||||
|
||||
return $responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header info to store.
|
||||
*
|
||||
* @param string $header
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function parseHeaders($header)
|
||||
{
|
||||
$headers = [];
|
||||
foreach (explode("\r\n", $header) as $line) {
|
||||
if (strpos($line, ':') !== false) {
|
||||
list ($key, $value) = explode(': ', $line);
|
||||
$key = str_replace('-', '_', strtolower($key));
|
||||
$headers[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode application authorization header with base64.
|
||||
*
|
||||
* @param Consumer $consumer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function encodeAppAuthorization($consumer)
|
||||
{
|
||||
// TODO: key and secret should be rfc 1738 encoded
|
||||
$key = $consumer->key;
|
||||
$secret = $consumer->secret;
|
||||
return base64_encode($key . ':' . $secret);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
* @author Abraham Williams <abraham@abrah.am>
|
||||
*/
|
||||
class TwitterOAuthException extends \Exception
|
||||
{
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
class Util
|
||||
{
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public static function urlencodeRfc3986($input)
|
||||
{
|
||||
$output = '';
|
||||
if (is_array($input)) {
|
||||
$output = array_map([__NAMESPACE__ . '\Util', 'urlencodeRfc3986'], $input);
|
||||
} elseif (is_scalar($input)) {
|
||||
$output = rawurlencode($input);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function urldecodeRfc3986($string)
|
||||
{
|
||||
return urldecode($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes a input like a=b&a=c&d=e and returns the parsed
|
||||
* parameters like this
|
||||
* array('a' => array('b','c'), 'd' => 'e')
|
||||
*
|
||||
* @param mixed $input
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parseParameters($input)
|
||||
{
|
||||
if (!isset($input) || !$input) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$pairs = explode('&', $input);
|
||||
|
||||
$parameters = [];
|
||||
foreach ($pairs as $pair) {
|
||||
$split = explode('=', $pair, 2);
|
||||
$parameter = Util::urldecodeRfc3986($split[0]);
|
||||
$value = isset($split[1]) ? Util::urldecodeRfc3986($split[1]) : '';
|
||||
|
||||
if (isset($parameters[$parameter])) {
|
||||
// We have already recieved parameter(s) with this name, so add to the list
|
||||
// of parameters with this name
|
||||
|
||||
if (is_scalar($parameters[$parameter])) {
|
||||
// This is the first duplicate, so transform scalar (string) into an array
|
||||
// so we can add the duplicates
|
||||
$parameters[$parameter] = [$parameters[$parameter]];
|
||||
}
|
||||
|
||||
$parameters[$parameter][] = $value;
|
||||
} else {
|
||||
$parameters[$parameter] = $value;
|
||||
}
|
||||
}
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function buildHttpQuery($params)
|
||||
{
|
||||
if (!$params) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Urlencode both keys and values
|
||||
$keys = Util::urlencodeRfc3986(array_keys($params));
|
||||
$values = Util::urlencodeRfc3986(array_values($params));
|
||||
$params = array_combine($keys, $values);
|
||||
|
||||
// Parameters are sorted by name, using lexicographical byte value ordering.
|
||||
// Ref: Spec: 9.1.1 (1)
|
||||
uksort($params, 'strcmp');
|
||||
|
||||
$pairs = [];
|
||||
foreach ($params as $parameter => $value) {
|
||||
if (is_array($value)) {
|
||||
// If two or more parameters share the same name, they are sorted by their value
|
||||
// Ref: Spec: 9.1.1 (1)
|
||||
// June 12th, 2010 - changed to sort because of issue 164 by hidetaka
|
||||
sort($value, SORT_STRING);
|
||||
foreach ($value as $duplicateValue) {
|
||||
$pairs[] = $parameter . '=' . $duplicateValue;
|
||||
}
|
||||
} else {
|
||||
$pairs[] = $parameter . '=' . $value;
|
||||
}
|
||||
}
|
||||
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
|
||||
// Each name-value pair is separated by an '&' character (ASCII code 38)
|
||||
return implode('&', $pairs);
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Abraham\TwitterOAuth\Util;
|
||||
|
||||
/**
|
||||
* @author louis <louis@systemli.org>
|
||||
*/
|
||||
class JsonDecoder
|
||||
{
|
||||
/**
|
||||
* Decodes a JSON string to stdObject or associative array
|
||||
*
|
||||
* @param string $string
|
||||
* @param bool $asArray
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
public static function decode($string, $asArray)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
||||
return json_decode($string, $asArray, 512, JSON_BIGINT_AS_STRING);
|
||||
}
|
||||
|
||||
return json_decode($string, $asArray);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
ini_set('display_errors', 1);
|
||||
require 'autoload.php';
|
||||
use Abraham\TwitterOAuth\TwitterOAuth;
|
||||
require_once('config.php');
|
||||
|
||||
/* Prepara la conexión */
|
||||
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
|
||||
|
||||
/* Solicita a twitter las credenciales temporales */
|
||||
//$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
|
||||
$request_token = $connection->oauth('oauth/request_token');
|
||||
|
||||
/* Guarda la credenciales temporales en sesión. */
|
||||
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
|
||||
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
|
||||
//switch ($connection->http_code) {
|
||||
// case 200:
|
||||
/* Construye la url de autorización y envía al usuario a Twitter. */
|
||||
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
//$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
|
||||
//$url = $connection->getAuthorizeURL($token);
|
||||
// print $url;
|
||||
header('Location: ' . $url);
|
||||
//break;
|
||||
// default:
|
||||
/* Indica que se ha producido un error. */
|
||||
// echo 'Error de conexión a Twitter.';
|
||||
// echo "\nHTTP CODE: " . $connection->http_code;
|
||||
//}
|
@ -1,177 +0,0 @@
|
||||
<?php session_start();
|
||||
ini_set('display_errors', 'On');
|
||||
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
|
||||
include_once("$_SESSION[path]/funciones/conex.php");
|
||||
echo brigadistas_grabar($_POST);
|
||||
function brigadistas_grabar($formulario) {
|
||||
|
||||
$identificador = $_POST['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $_POST['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#BrigadaDigital");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
||||
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
|
||||
</span>
|
||||
<a href='?set=$formulario[formulario_id]&embebido'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
//$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $_POST['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$_POST[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
include_once("$_SESSION[path]/funciones/conex.php");
|
||||
//include_once("$_SESSION[url]funciones/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
$ip = obtener_ip();
|
||||
$ip = " INET_ATON('".$ip."') ";
|
||||
foreach($_POST as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultado = "$preview $consulta ";
|
||||
|
||||
///$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $resultado;
|
||||
}
|
||||
function remplacetas($tabla,$campo,$valor,$por,$and){
|
||||
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
|
||||
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
|
||||
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
if (@mysqli_num_rows($sql)!=0){
|
||||
$resultado[] = mysqli_result($sql,0,$por);
|
||||
$resultado[] = mysqli_result($sql,0,'id');
|
||||
$resultado[] = $consulta;
|
||||
$resultado[] = mysqli_result($sql,0,"md5_$por");
|
||||
}else{
|
||||
$resultado[0] = '';
|
||||
$resultado[1] ="";
|
||||
$resultado[2] = $consulta;
|
||||
$resultado[3] = NULL;
|
||||
}
|
||||
return $resultado;
|
||||
}
|
||||
|
||||
function grabar_imagen($imagen,$control) {
|
||||
|
||||
$imgData = str_replace(' ','+',$imagen);
|
||||
$imgData = substr($imgData,strpos($imgData,",")+1);
|
||||
$imgData = base64_decode($imgData);
|
||||
|
||||
$nombre= $control.".png";
|
||||
$filePath = "$_SESSION[path]/tmp/".$nombre;
|
||||
|
||||
$file = fopen($filePath, 'w');
|
||||
fwrite($file, $imgData);
|
||||
fclose($file);
|
||||
$full= "$_SESSION[path_images_secure]/full/".$nombre;
|
||||
if (!rename($filePath,$full)){}
|
||||
else {
|
||||
echo generar_miniatura($nombre,"150");
|
||||
echo generar_miniatura($nombre,"300");
|
||||
echo generar_miniatura($nombre,"600");
|
||||
}
|
||||
|
||||
//return "$nombre";
|
||||
return "$nombre";
|
||||
}
|
||||
|
||||
|
||||
function generar_miniatura($file,$width) {
//$archivo = $file;
|
||||
$archivo = "$_SESSION[path_images_secure]/full/".$file;
// Ponemos el . antes del nombre del archivo porque estamos considerando que la ruta está a partir del archivo thumb.php
$file_info = getimagesize($archivo);
// Obtenemos la relación de aspecto
$ratio = $file_info[0] / $file_info[1];
// Calculamos las nuevas dimensiones
$newwidth = $width;
$newheight = round($newwidth / $ratio);
// Sacamos la extensión del archivo
$ext = explode(".", $file);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") $ext = "jpg";
// Dependiendo de la extensión llamamos a distintas funciones
switch ($ext) {
case "jpg":
$img = imagecreatefromjpeg($archivo);
break;
case "png":
$img = imagecreatefrompng($archivo);
break;
case "gif":
$img = imagecreatefromgif($archivo);
break;
}
// Creamos la miniatura
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagealphablending( $thumb, false );
|
||||
imagesavealpha( $thumb, true );
// La redimensionamos
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $file_info[0], $file_info[1]);
// La mostramos como jpg
//header("Content-type: image/jpeg");
imagejpeg($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 80);
|
||||
imagepng($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 9);
|
||||
//imagegif($thumb,"$_SESSION[path_images_secure]/".$width."/$file");
|
||||
//imagejpeg($thumb,null, 80);
|
||||
}
|
||||
|
||||
function buscar_campo_tipo($id,$tipo) {
|
||||
//// esta función retorna el id para un campo de un tipo especifico dentro de un formulario.
|
||||
$consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo,form_campos,form_contenido_campos
|
||||
WHERE form_tipo_campo.id_tipo_campo = form_campos.campo_tipo
|
||||
AND form_contenido_campos.id_campo = form_campos.id
|
||||
AND form_tipo_campo.id_tipo_campo = '$tipo'
|
||||
AND form_contenido_campos.id_form = '$id'";
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
if (mysqli_num_rows($sql)!='0'){
|
||||
$resultado[0]=mysqli_result($sql,0,"id");
|
||||
$resultado[1]=mysqli_result($sql,0,"campo_nombre");
|
||||
$resultado[2] =$consulta;
|
||||
}else{ $resultado[0]='';
|
||||
$resultado[2] =$consulta;
|
||||
}
|
||||
return $resultado;
|
||||
}
|
||||
|
||||
function obtener_ip()
|
||||
|
||||
{
|
||||
|
||||
if (isset($_SERVER["HTTP_CLIENT_IP"]))
|
||||
{
|
||||
return $_SERVER["HTTP_CLIENT_IP"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
|
||||
{
|
||||
return $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
|
||||
{
|
||||
return $_SERVER["HTTP_X_FORWARDED"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
|
||||
{
|
||||
return $_SERVER["HTTP_FORWARDED_FOR"];
|
||||
}
|
||||
elseif (isset($_SERVER["HTTP_FORWARDED"]))
|
||||
{
|
||||
return $_SERVER["HTTP_FORWARDED"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 38 KiB |
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Demo JS 1.9.1
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Meta 1.0.2
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Image meta data handling implementation
|
||||
* based on the help and contribution of
|
||||
* Achim Stöhr.
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint continue:true */
|
||||
/*global define, window, DataView, Blob, Uint8Array, console */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['load-image'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.loadImage);
|
||||
}
|
||||
}(function (loadImage) {
|
||||
'use strict';
|
||||
|
||||
var hasblobSlice = window.Blob && (Blob.prototype.slice ||
|
||||
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
||||
|
||||
loadImage.blobSlice = hasblobSlice && function () {
|
||||
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
||||
return slice.apply(this, arguments);
|
||||
};
|
||||
|
||||
loadImage.metaDataParsers = {
|
||||
jpeg: {
|
||||
0xffe1: [] // APP1 marker
|
||||
}
|
||||
};
|
||||
|
||||
// Parses image meta data and calls the callback with an object argument
|
||||
// with the following properties:
|
||||
// * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10)
|
||||
// The options arguments accepts an object and supports the following properties:
|
||||
// * maxMetaDataSize: Defines the maximum number of bytes to parse.
|
||||
// * disableImageHead: Disables creating the imageHead property.
|
||||
loadImage.parseMetaData = function (file, callback, options) {
|
||||
options = options || {};
|
||||
var that = this,
|
||||
// 256 KiB should contain all EXIF/ICC/IPTC segments:
|
||||
maxMetaDataSize = options.maxMetaDataSize || 262144,
|
||||
data = {},
|
||||
noMetaData = !(window.DataView && file && file.size >= 12 &&
|
||||
file.type === 'image/jpeg' && loadImage.blobSlice);
|
||||
if (noMetaData || !loadImage.readFile(
|
||||
loadImage.blobSlice.call(file, 0, maxMetaDataSize),
|
||||
function (e) {
|
||||
if (e.target.error) {
|
||||
// FileReader error
|
||||
console.log(e.target.error);
|
||||
callback(data);
|
||||
return;
|
||||
}
|
||||
// Note on endianness:
|
||||
// Since the marker and length bytes in JPEG files are always
|
||||
// stored in big endian order, we can leave the endian parameter
|
||||
// of the DataView methods undefined, defaulting to big endian.
|
||||
var buffer = e.target.result,
|
||||
dataView = new DataView(buffer),
|
||||
offset = 2,
|
||||
maxOffset = dataView.byteLength - 4,
|
||||
headLength = offset,
|
||||
markerBytes,
|
||||
markerLength,
|
||||
parsers,
|
||||
i;
|
||||
// Check for the JPEG marker (0xffd8):
|
||||
if (dataView.getUint16(0) === 0xffd8) {
|
||||
while (offset < maxOffset) {
|
||||
markerBytes = dataView.getUint16(offset);
|
||||
// Search for APPn (0xffeN) and COM (0xfffe) markers,
|
||||
// which contain application-specific meta-data like
|
||||
// Exif, ICC and IPTC data and text comments:
|
||||
if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||
|
||||
markerBytes === 0xfffe) {
|
||||
// The marker bytes (2) are always followed by
|
||||
// the length bytes (2), indicating the length of the
|
||||
// marker segment, which includes the length bytes,
|
||||
// but not the marker bytes, so we add 2:
|
||||
markerLength = dataView.getUint16(offset + 2) + 2;
|
||||
if (offset + markerLength > dataView.byteLength) {
|
||||
console.log('Invalid meta data: Invalid segment size.');
|
||||
break;
|
||||
}
|
||||
parsers = loadImage.metaDataParsers.jpeg[markerBytes];
|
||||
if (parsers) {
|
||||
for (i = 0; i < parsers.length; i += 1) {
|
||||
parsers[i].call(
|
||||
that,
|
||||
dataView,
|
||||
offset,
|
||||
markerLength,
|
||||
data,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
offset += markerLength;
|
||||
headLength = offset;
|
||||
} else {
|
||||
// Not an APPn or COM marker, probably safe to
|
||||
// assume that this is the end of the meta data
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Meta length must be longer than JPEG marker (2)
|
||||
// plus APPn marker (2), followed by length bytes (2):
|
||||
if (!options.disableImageHead && headLength > 6) {
|
||||
if (buffer.slice) {
|
||||
data.imageHead = buffer.slice(0, headLength);
|
||||
} else {
|
||||
// Workaround for IE10, which does not yet
|
||||
// support ArrayBuffer.slice:
|
||||
data.imageHead = new Uint8Array(buffer)
|
||||
.subarray(0, headLength);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('Invalid JPEG file: Missing JPEG marker.');
|
||||
}
|
||||
callback(data);
|
||||
},
|
||||
'readAsArrayBuffer'
|
||||
)) {
|
||||
callback(data);
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
@ -1,166 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image Orientation 1.1.0
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*global define, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['load-image'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.loadImage);
|
||||
}
|
||||
}(function (loadImage) {
|
||||
'use strict';
|
||||
|
||||
var originalHasCanvasOption = loadImage.hasCanvasOption,
|
||||
originalTransformCoordinates = loadImage.transformCoordinates,
|
||||
originalGetTransformedOptions = loadImage.getTransformedOptions;
|
||||
|
||||
// This method is used to determine if the target image
|
||||
// should be a canvas element:
|
||||
loadImage.hasCanvasOption = function (options) {
|
||||
return originalHasCanvasOption.call(loadImage, options) ||
|
||||
options.orientation;
|
||||
};
|
||||
|
||||
// Transform image orientation based on
|
||||
// the given EXIF orientation option:
|
||||
loadImage.transformCoordinates = function (canvas, options) {
|
||||
originalTransformCoordinates.call(loadImage, canvas, options);
|
||||
var ctx = canvas.getContext('2d'),
|
||||
width = canvas.width,
|
||||
height = canvas.height,
|
||||
orientation = options.orientation;
|
||||
if (!orientation || orientation > 8) {
|
||||
return;
|
||||
}
|
||||
if (orientation > 4) {
|
||||
canvas.width = height;
|
||||
canvas.height = width;
|
||||
}
|
||||
switch (orientation) {
|
||||
case 2:
|
||||
// horizontal flip
|
||||
ctx.translate(width, 0);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 3:
|
||||
// 180° rotate left
|
||||
ctx.translate(width, height);
|
||||
ctx.rotate(Math.PI);
|
||||
break;
|
||||
case 4:
|
||||
// vertical flip
|
||||
ctx.translate(0, height);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 5:
|
||||
// vertical flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 6:
|
||||
// 90° rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(0, -height);
|
||||
break;
|
||||
case 7:
|
||||
// horizontal flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(width, -height);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 8:
|
||||
// 90° rotate left
|
||||
ctx.rotate(-0.5 * Math.PI);
|
||||
ctx.translate(-width, 0);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Transforms coordinate and dimension options
|
||||
// based on the given orientation option:
|
||||
loadImage.getTransformedOptions = function (img, opts) {
|
||||
var options = originalGetTransformedOptions.call(loadImage, img, opts),
|
||||
orientation = options.orientation,
|
||||
newOptions,
|
||||
i;
|
||||
if (!orientation || orientation > 8 || orientation === 1) {
|
||||
return options;
|
||||
}
|
||||
newOptions = {};
|
||||
for (i in options) {
|
||||
if (options.hasOwnProperty(i)) {
|
||||
newOptions[i] = options[i];
|
||||
}
|
||||
}
|
||||
switch (options.orientation) {
|
||||
case 2:
|
||||
// horizontal flip
|
||||
newOptions.left = options.right;
|
||||
newOptions.right = options.left;
|
||||
break;
|
||||
case 3:
|
||||
// 180° rotate left
|
||||
newOptions.left = options.right;
|
||||
newOptions.top = options.bottom;
|
||||
newOptions.right = options.left;
|
||||
newOptions.bottom = options.top;
|
||||
break;
|
||||
case 4:
|
||||
// vertical flip
|
||||
newOptions.top = options.bottom;
|
||||
newOptions.bottom = options.top;
|
||||
break;
|
||||
case 5:
|
||||
// vertical flip + 90 rotate right
|
||||
newOptions.left = options.top;
|
||||
newOptions.top = options.left;
|
||||
newOptions.right = options.bottom;
|
||||
newOptions.bottom = options.right;
|
||||
break;
|
||||
case 6:
|
||||
// 90° rotate right
|
||||
newOptions.left = options.top;
|
||||
newOptions.top = options.right;
|
||||
newOptions.right = options.bottom;
|
||||
newOptions.bottom = options.left;
|
||||
break;
|
||||
case 7:
|
||||
// horizontal flip + 90 rotate right
|
||||
newOptions.left = options.bottom;
|
||||
newOptions.top = options.right;
|
||||
newOptions.right = options.top;
|
||||
newOptions.bottom = options.left;
|
||||
break;
|
||||
case 8:
|
||||
// 90° rotate left
|
||||
newOptions.left = options.bottom;
|
||||
newOptions.top = options.left;
|
||||
newOptions.right = options.top;
|
||||
newOptions.bottom = options.right;
|
||||
break;
|
||||
}
|
||||
if (options.orientation > 4) {
|
||||
newOptions.maxWidth = options.maxHeight;
|
||||
newOptions.maxHeight = options.maxWidth;
|
||||
newOptions.minWidth = options.minHeight;
|
||||
newOptions.minHeight = options.minWidth;
|
||||
newOptions.sourceWidth = options.sourceHeight;
|
||||
newOptions.sourceHeight = options.sourceWidth;
|
||||
}
|
||||
return newOptions;
|
||||
};
|
||||
|
||||
}));
|
1
addon/logis/js/load-image.all.min.js
vendored
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* JavaScript Load Image 1.10.0
|
||||
* https://github.com/blueimp/JavaScript-Load-Image
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true */
|
||||
/*global define, window, document, URL, webkitURL, Blob, File, FileReader */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Loads an image for a given File object.
|
||||
// Invokes the callback with an img or optional canvas
|
||||
// element (if supported by the browser) as parameter:
|
||||
var loadImage = function (file, callback, options) {
|
||||
var img = document.createElement('img'),
|
||||
url,
|
||||
oUrl;
|
||||
//img.setAttribute('class', 'watermark');
|
||||
// img.setAttribute('id', 'image_output2');
|
||||
img.onerror = callback;
|
||||
img.onload = function () {
|
||||
if (oUrl && !(options && options.noRevoke)) {
|
||||
loadImage.revokeObjectURL(oUrl);
|
||||
}
|
||||
if (callback) {
|
||||
callback(loadImage.scale(img, options));
|
||||
}
|
||||
};
|
||||
if (loadImage.isInstanceOf('Blob', file) ||
|
||||
// Files are also Blob instances, but some browsers
|
||||
// (Firefox 3.6) support the File API but not Blobs:
|
||||
loadImage.isInstanceOf('File', file)) {
|
||||
url = oUrl = loadImage.createObjectURL(file);
|
||||
// Store the file type for resize processing:
|
||||
img._type = file.type;
|
||||
} else if (typeof file === 'string') {
|
||||
url = file;
|
||||
if (options && options.crossOrigin) {
|
||||
img.crossOrigin = options.crossOrigin;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (url) {
|
||||
img.src = url;
|
||||
//document.getElementById('image_output').src = url ;
|
||||
//document.getElementById('image_output').className = "watermark" ;
|
||||
return img;
|
||||
}
|
||||
return loadImage.readFile(file, function (e) {
|
||||
var target = e.target;
|
||||
if (target && target.result) {
|
||||
img.src = target.result;
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
|
||||
// which provides URL.createObjectURL but doesn't properly implement it:
|
||||
urlAPI = (window.createObjectURL && window) ||
|
||||
(window.URL && URL.revokeObjectURL && URL) ||
|
||||
(window.webkitURL && webkitURL);
|
||||
|
||||
loadImage.isInstanceOf = function (type, obj) {
|
||||
// Cross-frame instanceof check
|
||||
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
||||
};
|
||||
|
||||
// Transform image coordinates, allows to override e.g.
|
||||
// the canvas orientation based on the orientation option,
|
||||
// gets canvas, options passed as arguments:
|
||||
loadImage.transformCoordinates = function () {
|
||||
return;
|
||||
};
|
||||
|
||||
// Returns transformed options, allows to override e.g.
|
||||
// maxWidth, maxHeight and crop options based on the aspectRatio.
|
||||
// gets img, options passed as arguments:
|
||||
loadImage.getTransformedOptions = function (img, options) {
|
||||
var aspectRatio = options.aspectRatio,
|
||||
newOptions,
|
||||
i,
|
||||
width,
|
||||
height;
|
||||
if (!aspectRatio) {
|
||||
return options;
|
||||
}
|
||||
newOptions = {};
|
||||
for (i in options) {
|
||||
if (options.hasOwnProperty(i)) {
|
||||
newOptions[i] = options[i];
|
||||
}
|
||||
}
|
||||
newOptions.crop = true;
|
||||
width = img.naturalWidth || img.width;
|
||||
height = img.naturalHeight || img.height;
|
||||
if (width / height > aspectRatio) {
|
||||
newOptions.maxWidth = height * aspectRatio;
|
||||
newOptions.maxHeight = height;
|
||||
} else {
|
||||
newOptions.maxWidth = width;
|
||||
newOptions.maxHeight = width / aspectRatio;
|
||||
}
|
||||
return newOptions;
|
||||
};
|
||||
|
||||
// Canvas render method, allows to override the
|
||||
// rendering e.g. to work around issues on iOS:
|
||||
loadImage.renderImageToCanvas = function (
|
||||
canvas,
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
destX,
|
||||
destY,
|
||||
destWidth,
|
||||
destHeight
|
||||
) {
|
||||
canvas.getContext('2d').drawImage(
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
destX,
|
||||
destY,
|
||||
destWidth,
|
||||
destHeight
|
||||
);
|
||||
return canvas;
|
||||
};
|
||||
|
||||
// This method is used to determine if the target image
|
||||
// should be a canvas element:
|
||||
loadImage.hasCanvasOption = function (options) {
|
||||
return options.canvas || options.crop || options.aspectRatio;
|
||||
};
|
||||
|
||||
// Scales and/or crops the given image (img or canvas HTML element)
|
||||
// using the given options.
|
||||
// Returns a canvas object if the browser supports canvas
|
||||
// and the hasCanvasOption method returns true or a canvas
|
||||
// object is passed as image, else the scaled image:
|
||||
loadImage.scale = function (img, options) {
|
||||
options = options || {};
|
||||
var canvas = document.createElement('canvas'),
|
||||
useCanvas = img.getContext ||
|
||||
(loadImage.hasCanvasOption(options) && canvas.getContext),
|
||||
width = img.naturalWidth || img.width,
|
||||
height = img.naturalHeight || img.height,
|
||||
destWidth = width,
|
||||
destHeight = height,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
minWidth,
|
||||
minHeight,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
sourceX,
|
||||
sourceY,
|
||||
tmp,
|
||||
scaleUp = function () {
|
||||
var scale = Math.max(
|
||||
(minWidth || destWidth) / destWidth,
|
||||
(minHeight || destHeight) / destHeight
|
||||
);
|
||||
if (scale > 1) {
|
||||
destWidth = destWidth * scale;
|
||||
destHeight = destHeight * scale;
|
||||
}
|
||||
},
|
||||
scaleDown = function () {
|
||||
var scale = Math.min(
|
||||
(maxWidth || destWidth) / destWidth,
|
||||
(maxHeight || destHeight) / destHeight
|
||||
);
|
||||
if (scale < 1) {
|
||||
destWidth = destWidth * scale;
|
||||
destHeight = destHeight * scale;
|
||||
}
|
||||
};
|
||||
if (useCanvas) {
|
||||
options = loadImage.getTransformedOptions(img, options);
|
||||
sourceX = options.left || 0;
|
||||
sourceY = options.top || 0;
|
||||
if (options.sourceWidth) {
|
||||
sourceWidth = options.sourceWidth;
|
||||
if (options.right !== undefined && options.left === undefined) {
|
||||
sourceX = width - sourceWidth - options.right;
|
||||
}
|
||||
} else {
|
||||
sourceWidth = width - sourceX - (options.right || 0);
|
||||
}
|
||||
if (options.sourceHeight) {
|
||||
sourceHeight = options.sourceHeight;
|
||||
if (options.bottom !== undefined && options.top === undefined) {
|
||||
sourceY = height - sourceHeight - options.bottom;
|
||||
}
|
||||
} else {
|
||||
sourceHeight = height - sourceY - (options.bottom || 0);
|
||||
}
|
||||
destWidth = sourceWidth;
|
||||
destHeight = sourceHeight;
|
||||
}
|
||||
maxWidth = options.maxWidth;
|
||||
maxHeight = options.maxHeight;
|
||||
minWidth = options.minWidth;
|
||||
minHeight = options.minHeight;
|
||||
if (useCanvas && maxWidth && maxHeight && options.crop) {
|
||||
destWidth = maxWidth;
|
||||
destHeight = maxHeight;
|
||||
tmp = sourceWidth / sourceHeight - maxWidth / maxHeight;
|
||||
if (tmp < 0) {
|
||||
sourceHeight = maxHeight * sourceWidth / maxWidth;
|
||||
if (options.top === undefined && options.bottom === undefined) {
|
||||
sourceY = (height - sourceHeight) / 2;
|
||||
}
|
||||
} else if (tmp > 0) {
|
||||
sourceWidth = maxWidth * sourceHeight / maxHeight;
|
||||
if (options.left === undefined && options.right === undefined) {
|
||||
sourceX = (width - sourceWidth) / 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (options.contain || options.cover) {
|
||||
minWidth = maxWidth = maxWidth || minWidth;
|
||||
minHeight = maxHeight = maxHeight || minHeight;
|
||||
}
|
||||
if (options.cover) {
|
||||
scaleDown();
|
||||
scaleUp();
|
||||
} else {
|
||||
scaleUp();
|
||||
scaleDown();
|
||||
}
|
||||
}
|
||||
if (useCanvas) {
|
||||
canvas.width = destWidth;
|
||||
canvas.height = destHeight;
|
||||
loadImage.transformCoordinates(
|
||||
canvas,
|
||||
options
|
||||
);
|
||||
return loadImage.renderImageToCanvas(
|
||||
canvas,
|
||||
img,
|
||||
sourceX,
|
||||
sourceY,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
0,
|
||||
0,
|
||||
destWidth,
|
||||
destHeight
|
||||
);
|
||||
}
|
||||
img.width = destWidth;
|
||||
img.height = destHeight;
|
||||
return img;
|
||||
};
|
||||
|
||||
loadImage.createObjectURL = function (file) {
|
||||
return urlAPI ? urlAPI.createObjectURL(file) : false;
|
||||
};
|
||||
|
||||
loadImage.revokeObjectURL = function (url) {
|
||||
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
|
||||
};
|
||||
|
||||
// Loads a given File object via FileReader interface,
|
||||
// invokes the callback with the event object (load or error).
|
||||
// The result can be read via event.target.result:
|
||||
loadImage.readFile = function (file, callback, method) {
|
||||
if (window.FileReader) {
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = fileReader.onerror = callback;
|
||||
method = method || 'readAsDataURL';
|
||||
if (fileReader[method]) {
|
||||
fileReader[method](file);
|
||||
return fileReader;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return loadImage;
|
||||
});
|
||||
} else {
|
||||
$.loadImage = loadImage;
|
||||
}
|
||||
}(window));
|
@ -1,365 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
//$id_formulario = "58";
|
||||
$id_formulario = "88";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
//$tags[] = "milfs/addon/logis/images/logos/250.png";
|
||||
$tags[] = "milfs/addon/logis/images/logos/c.png";
|
||||
$imagen="";
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<div>
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px important!;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: <?php echo $ancho ?>px;
|
||||
}
|
||||
body{
|
||||
background-color:white !important;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.pin {
|
||||
text-align: center;
|
||||
/*border: solid 1px red;*/
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
.ing-touch{
|
||||
border: solid 5px white;
|
||||
width:20% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class='container' style='height:100%; backgroun-color:white;' id='aviso'>
|
||||
|
||||
<div class='fileUpload btn btn-primary center-block'>
|
||||
<span><h1><i class="fa fa-camera"></i> + tu Foto</h1></span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<canvas id="micanvasOriginal" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin" ><a href="#arriba" onclick=" javascript: marcar('top-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:20%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin" ><a href="#medio" onclick=" javascript: marcar('middle-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><img class="ing-touch img img-circle img-responsive center-block " style="width:50%;" src="milfs/images/oscuro40.png"></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
|
||||
</div>
|
||||
<div class="row " style="position:relative">
|
||||
|
||||
|
||||
<form id='formulario_brigadistas' name='formulario_brigadistas' >
|
||||
<!-- <input class='form-control' type='' id="debugConsole" name="debugConsole" > -->
|
||||
<textarea class='form-control' id="debugConsole" name="debugConsole" style="display:none;" ></textarea>
|
||||
<input type='hidden' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- <div id='aviso'></div> -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) -->
|
||||
<!-- <button class='fileUpload btn btn-success btn-block' onclick="document.getElementById('formulario_brigadistas').submit(); "> -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" xajax_wait('aviso','Grabando... un momento por favor...'); xajax_brigadistas_grabar(xajax.getFormValues('formulario_brigadistas')) ; ">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $ultimo = formulario_uso("$id_formulario",'','ultimo') ;
|
||||
//echo $ultimo[1];
|
||||
echo mostrar_identificador("$ultimo[1]","","landingpage",'simple');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?php echo $ancho ?>;
|
||||
micanvas.width =ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
var testCanvas = document.getElementById("micanvas");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
|
||||
debugConsole.value=canvasData;
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
var result = $('#result'),
|
||||
exifNode = $('#exif'),
|
||||
thumbNode = $('#thumbnail'),
|
||||
actionsNode = $('#actions'),
|
||||
currentFile,
|
||||
replaceResults = function (img) {
|
||||
var content;
|
||||
if (!(img.src || img instanceof HTMLCanvasElement)) {
|
||||
content = $('<span>Loading image file failed</span>');
|
||||
} else {
|
||||
content = $('<img />').append(img)
|
||||
//.attr('download', currentFile.name)
|
||||
.attr('src', img.src || img.toDataURL())
|
||||
.attr('width', '<?php echo $ancho ?>')
|
||||
.attr('style', 'width:100%')
|
||||
.attr('id', 'imagen_original');
|
||||
|
||||
}
|
||||
//document.getElementById('image_output').src = img.src;
|
||||
result.children().replaceWith(content);
|
||||
if (img.getContext) {
|
||||
actionsNode.show();
|
||||
/// render(img.src);
|
||||
window.setTimeout("marcar('middle-center');", 500);
|
||||
|
||||
}
|
||||
},
|
||||
displayImage = function (file, options) {
|
||||
currentFile = file;
|
||||
if (!loadImage(
|
||||
file,
|
||||
replaceResults,
|
||||
options
|
||||
)) {
|
||||
result.children().replaceWith(
|
||||
$('<span>Your browser does not support the URL or FileReader API.</span>')
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
dropChangeHandler = function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
var target = e.dataTransfer || e.target,
|
||||
file = target && target.files && target.files[0],
|
||||
options = {
|
||||
//maxWidth: result.width(),
|
||||
maxWidth: <?php echo $ancho ?>,
|
||||
canvas: true
|
||||
};
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
exifNode.hide();
|
||||
thumbNode.hide();
|
||||
loadImage.parseMetaData(file, function (data) {
|
||||
if (data.exif) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
// displayExifData(data.exif);
|
||||
}
|
||||
displayImage(file, options);
|
||||
});
|
||||
},
|
||||
coordinates;
|
||||
// Hide URL/FileReader API requirement message in capable browsers:
|
||||
if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
|
||||
result.children().hide();
|
||||
}
|
||||
|
||||
$(document)
|
||||
.on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e = e.originalEvent;
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
})
|
||||
.on('drop', dropChangeHandler);
|
||||
$('#file-input').on('change', dropChangeHandler);
|
||||
$('#edit').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var imgNode = result.find('img, canvas'),
|
||||
img = imgNode[0];
|
||||
imgNode.Jcrop({
|
||||
setSelect: [40, 40, img.width - 40, img.height - 40],
|
||||
onSelect: function (coords) {
|
||||
coordinates = coords;
|
||||
},
|
||||
onRelease: function () {
|
||||
coordinates = null;
|
||||
}
|
||||
}).parent().on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#crop').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var img = result.find('img, canvas')[0];
|
||||
if (img && coordinates) {
|
||||
replaceResults(loadImage.scale(img, {
|
||||
left: coordinates.x,
|
||||
top: coordinates.y,
|
||||
sourceWidth: coordinates.w,
|
||||
sourceHeight: coordinates.h,
|
||||
minWidth: result.width()
|
||||
}));
|
||||
coordinates = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="milfs/addon/logis/js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<!-- <script src="js/demo.js"></script> -->
|
||||
</div>
|
@ -1,207 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
|
||||
<!-- <link rel="stylesheet" href="css/demo.css"> -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: 800px;
|
||||
}
|
||||
.pin {
|
||||
text-align: center;
|
||||
border: solid 1px red;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='container'>
|
||||
<div class='fileUpload btn btn-primary '>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
<input type="hidden" id='identificador' name='identificador'>
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = 800;
|
||||
micanvas.width = ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<script src="js/demo.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,207 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "58";
|
||||
$ancho = "600";
|
||||
|
||||
$tags = array();
|
||||
$tags[] = "images/logos/c.png";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td onclick=\" document.getElementById('marca').src='$valor' ; marcar('top-left') \" ><a href='#medio' class='' >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr >
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="description" content="JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnails and to restore the complete image header after resizing.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Jcrop is not required by JavaScript Load Image, but included for the demo -->
|
||||
<!-- <link rel="stylesheet" href="css/vendor/jquery.Jcrop.css"> -->
|
||||
<!-- <link rel="stylesheet" href="css/demo.css"> -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
|
||||
<style type="text/css">
|
||||
.fa{
|
||||
font-size:60px;
|
||||
}
|
||||
#imagen_origina{
|
||||
width: 800px;
|
||||
}
|
||||
.pin {
|
||||
text-align: center;
|
||||
border: solid 1px red;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='container'>
|
||||
<div class='fileUpload btn btn-primary '>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Imagen <i class="fa fa-camera"></i> </span>
|
||||
<input class='upload' type="file" id="file-input" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p><input type="file" id="file-input"></p> -->
|
||||
<div id="actions" style="display:none;">
|
||||
<img class="center-block" src= "<?php echo $tags[0]; ?>" style='display:none' id="marca" name="marca">
|
||||
<img class="center-block" style='' id="image_output" name="image_output">
|
||||
<img class="center-block" style='' id="otra_imagen" name="otra_imagen">
|
||||
<input type="hidden" id='identificador' name='identificador'>
|
||||
|
||||
<div id="result" class="result">
|
||||
<p></p>
|
||||
</div>
|
||||
<a name="arriba"></a>
|
||||
<div style="position:relative">
|
||||
<div style="position:absolute; width:100%; height:100%;" >
|
||||
<table style="width:100%; height:100%;" class="">
|
||||
<tr >
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#arriba" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a name="medio"></a><a href="#arriba" onclick=" javascript: marcar('middle-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-circle-o"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td class="pin"><a href="#medio" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-circle-o"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<canvas id="micanvas" style="position:absolute" >
|
||||
Tu navegador no soporta canvas.
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
function cargaContextoCanvas(idCanvas){
|
||||
var elemento = document.getElementById(idCanvas);
|
||||
if(elemento && elemento.getContext){
|
||||
var contexto = elemento.getContext('2d');
|
||||
if(contexto){
|
||||
return contexto;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
function marcar(ubicacion){
|
||||
//if (ubicacion == 'arriba'){ var x = '0';var y = '0';}
|
||||
//if (ubicacion == 'abajo'){ var x = '10';var y = '50';}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Recibimos el elemento canvas
|
||||
var ctx = cargaContextoCanvas('micanvas');
|
||||
|
||||
if(ctx){
|
||||
//Creo una imagen conun objeto Image de Javascript
|
||||
var img = new Image();
|
||||
var img2 = new Image();
|
||||
//img.src = document.getElementById("image_output2").src;
|
||||
//readAsDataURL(
|
||||
img.src = document.getElementById("imagen_original").src;
|
||||
document.getElementById("imagen_original").style.display="none";
|
||||
//img2.src = 'images/logos/a.png';
|
||||
img2.src = document.getElementById("marca").src;
|
||||
if (ubicacion =='') {
|
||||
ubicacion ='middle-center';
|
||||
}
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(ubicacion.indexOf("top")!=-1)
|
||||
y = 10;
|
||||
else if(ubicacion.indexOf("middle")!=-1)
|
||||
y = (micanvas.height - img2.height)/2;
|
||||
else
|
||||
y = micanvas.height-img2.height-10;
|
||||
|
||||
if(ubicacion.indexOf("left")!=-1)
|
||||
x = 10;
|
||||
else if(ubicacion.indexOf("center")!=-1)
|
||||
x = (micanvas.width - img2.width) /2;
|
||||
else
|
||||
x = micanvas.width-img2.width-10;
|
||||
|
||||
|
||||
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = 800;
|
||||
micanvas.width = ancho;
|
||||
micanvas.height = (micanvas.width * proporcion);
|
||||
micanvas.setAttribute('width', ancho);
|
||||
micanvas.setAttribute('height', micanvas.height);
|
||||
micanvas.setAttribute('style',"width:100%");
|
||||
|
||||
img.onload = function(){
|
||||
ctx.drawImage(img, 0, 0,micanvas.width,micanvas.height);
|
||||
ctx.drawImage(img2, x, y);
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<br>
|
||||
<script src="js/load-image.all.min.js"></script>
|
||||
<!-- <script src="js/load-image.js"></script> -->
|
||||
<!-- <script src="js/load-image-ios.js"></script> -->
|
||||
<!-- <script src="js/load-image-orientation.js"></script> -->
|
||||
<!-- <script src="js/load-image-meta.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif.js"></script> -->
|
||||
<!-- <script src="js/load-image-exif-map.js"></script> -->
|
||||
<!-- jQuery and Jcrop are not required by JavaScript Load Image, but included for the demo -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<!-- <script src="js/vendor/jquery.Jcrop.js"></script> -->
|
||||
<script src="js/demo.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
function machitroll_grabar_imagen($data,$identificador) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$control = md5("$identificador");
|
||||
//$form_id = $fomulario["formulario_id"];
|
||||
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
|
||||
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
|
||||
$respuesta->addAssign("aviso","innerHTML","$preview");
|
||||
return $respuesta;
|
||||
|
||||
}
|
||||
$xajax->registerFunction("machitroll_grabar_imagen");
|
||||
|
||||
function machitroll_grabar($formulario) {
|
||||
|
||||
$identificador = $formulario['identificador'];
|
||||
$control = md5("$identificador");
|
||||
$data = $formulario['debugConsole'];
|
||||
$imagen= grabar_imagen($data,$control);
|
||||
$texto_url = urlencode("#AlertaMachiTroll https://actua.karisma.org.co/alertamachitroll");
|
||||
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
||||
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
||||
//$respuesta->addScript("window.location.href ='$url';");
|
||||
$preview = "
|
||||
<div class='row'>
|
||||
<div class='center-block'>
|
||||
<div class='thumbnail'>
|
||||
<img src='$_SESSION[url]/images/secure/?file=600/$imagen'>
|
||||
<a download='machitroll.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
||||
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
||||
</a>
|
||||
<span class='btn btn-default'>
|
||||
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
|
||||
</span>
|
||||
<a href='?set=$formulario[formulario_id]&embebido'>
|
||||
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
||||
</a>
|
||||
<a href='#' onclick = \"javascript:location.reload(); \">
|
||||
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
//$identificador = $formulario['identificador'];
|
||||
$id_formulario = $formulario['formulario_id'];
|
||||
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
||||
$formulario[$campo_imagen[0]][0] = $imagen;
|
||||
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
||||
$id_empresa = $empresa[0];
|
||||
|
||||
include_once("librerias/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
|
||||
foreach($formulario as $campo=>$valor){
|
||||
if(is_array($valor)) {
|
||||
foreach($valor as $c=>$v){
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultado = "$preview ";
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$resultado");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("machitroll_grabar");
|
||||
|
||||
function machitroll_grabarX($formulario) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$control = md5($formulario['identificador']);
|
||||
$form_id = $fomulario["formulario_id"];
|
||||
if($formulario['debugConsole'] !="") {
|
||||
$imagen= grabar_imagen($formulario['debugConsole'],$control);
|
||||
|
||||
}
|
||||
$campo_imagen = buscar_campo_tipo("$form_id","15");
|
||||
$formulario["$campo_imagen[0]"][0] = "$imagen";
|
||||
$formulario["formulario_id"] = $fomulario["formulario_id"];
|
||||
$formulario["formulario_id"] = $fomulario["formulario_id"];
|
||||
|
||||
|
||||
include_once("librerias/conex.php");
|
||||
$link=Conectarse();
|
||||
mysqli_query("SET NAMES 'utf8'");
|
||||
/*
|
||||
foreach($formulario as $c=>$v){
|
||||
$campo .= "( $c : $v )<br> ";
|
||||
|
||||
//LISTA ELEMENTOS DE UN ARRAY
|
||||
if (is_array($v) ){
|
||||
foreach($v as $C=>$V){
|
||||
$campo .= " Array ( $c : $V )<br> ";
|
||||
if($V != '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
foreach($formulario as $C=>$V){
|
||||
$campo = "$C";
|
||||
$form_id= $formulario['formulario_id'];
|
||||
|
||||
if(is_array($V)) {
|
||||
|
||||
foreach($V as $c=>$v){
|
||||
//$hora = $id_orden['hora'][$C];
|
||||
//$dia = "$V";
|
||||
//$control = md5(rand(1,99999999).microtime());
|
||||
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
||||
( UNIX_TIMESTAMP(),'$_SESSION[id]','$_SESSION[id_empresa]','$form_id','$ip' ,'$control', '$campo' , '$v')
|
||||
";
|
||||
$sql=mysqli_query($consulta,$link);
|
||||
|
||||
$filas .= "<li> $C - $V - $c - $v ///$campo -> $V $consulta $debug </li>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$resultado = "Hola mundo ".$formulario[498][0]." <textarea class='form-group'>$formulario[debugConsole]</textarea> ";
|
||||
//$resultado= " $campo ";
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$resultado ");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("machitroll_grabarX");
|
||||
|
||||
?>
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 148 KiB |
@ -1,487 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$id_formulario = "61";
|
||||
$ancho = "600";
|
||||
/*
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/machitroll/images/incurable/100.png";
|
||||
$tags[] = "milfs/addon/machitroll/images/incurable/200.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/incurable/300.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/incurable/400.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/incurable/500.png";
|
||||
$tags[] = "milfs/addon/machitroll/images/rescatable/100.png";
|
||||
$tags[] = "milfs/addon/machitroll/images/rescatable/200.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/rescatable/300.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/rescatable/400.png";
|
||||
//$tags[] = "milfs/addon/machitroll/images/rescatable/500.png";
|
||||
|
||||
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<td><a href='#medio' class='' onclick=\" document.getElementById('marca').src='$valor' \" >
|
||||
<img class='img ' src='$valor'>
|
||||
</a></td>";
|
||||
}
|
||||
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tr>
|
||||
$imagen
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
*/
|
||||
$imagen = "
|
||||
<div class='table-responsive'>
|
||||
<table class='table table table-condensed text-center '>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/incurable/100.png '\" >
|
||||
<img class='img ' src='milfs/addon/machitroll/images/incurable/100.png'>
|
||||
</a>
|
||||
<br>
|
||||
<span>INCURABLE</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/incurable/200.png '\" >
|
||||
<img class='img ' src='milfs/addon/machitroll/images/incurable/200.png'>
|
||||
</a><br>
|
||||
<span>INCURABLE</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/rescatable/100.png '\" >
|
||||
<img class='img ' src='milfs/addon/machitroll/images/rescatable/100.png'>
|
||||
</a><br>
|
||||
<span>RESCATABLE</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href='#medio' class='' onclick=\" document.getElementById('marca').src='milfs/addon/machitroll/images/rescatable/200.png '\" >
|
||||
<img class='img ' src='milfs/addon/machitroll/images/rescatable/200.png'>
|
||||
</a><br>
|
||||
<span>RESCATABLE</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
|
||||
?>
|
||||
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
|
||||
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cabin" type="text/css"/>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: 'CabinRegular';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
.fa{
|
||||
font-size:20px;
|
||||
}
|
||||
|
||||
#downlink_hidden , #fieldset_General , #canvas_ed , #original{
|
||||
display:none;
|
||||
}
|
||||
#body{
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='aviso'>
|
||||
|
||||
<div id ="body" class="container-fluid">
|
||||
|
||||
<div id="div_machitroll" class="container">
|
||||
<span class='btn btn-primary btn-block' > <!-- <i class="fa fa-picture-o"></i> --> <span class='fa' > Elige un #MachiTroll </span></span>
|
||||
<?php echo $imagen; ?>
|
||||
<a name="medio"></a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='fileUpload btn btn-primary btn-block'>
|
||||
<span> <i class="fa fa-picture-o"></i> <span class='fa' > Sube pantallazo</span>
|
||||
<input class='upload' type="file" id="files" name="files[]" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a name="abajo"></a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='container-fluid'>
|
||||
<table style="" class="table text-center table-responsive">
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- editor -->
|
||||
|
||||
<div class='container-fluid'>
|
||||
|
||||
|
||||
<div style="background-color:; " >
|
||||
<img class="center-block" style='display: none' id="marca" name="marca">
|
||||
|
||||
<div id="list" style=" "></div>
|
||||
<img id='image_output2' name='image_output2' src="" class="" />
|
||||
|
||||
<div id='div_canvas' style='display: none'> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<form id='formulario_machitroll' name='formulario_machitroll' >
|
||||
<input type='hidden' id="debugConsole" name="debugConsole" >
|
||||
<input type='hidden' id="identificador" name="identificador" >
|
||||
<input type='hidden' id="formulario_id" name="formulario_id" value="<?php echo $id_formulario; ?>">
|
||||
<input type='hidden' id="imagen" name="imagen" value="">
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- -->
|
||||
<button class='fileUpload btn btn-success btn-block' onclick=" this.disabled= true; xajax_wait('aviso','Grabando... un momento por favor...'); saveViaAJAX(); xajax_machitroll_grabar(xajax.getFormValues('formulario_machitroll'))">
|
||||
<span><i class="fa fa-save"></i> <span class='fa'> Grabalo! </span></span>
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- fin aviso -->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
$("body").append(canvas);
|
||||
};
|
||||
|
||||
function convertImageToCanvas(image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.getContext("2d").drawImage(image, 0, 0);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function convertCanvasToImage(canvas) {
|
||||
var image = new Image();
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
return image;
|
||||
}
|
||||
|
||||
function saveViaAJAX()
|
||||
{
|
||||
/* function loadCanvas(id) {
|
||||
var canvas = document.createElement('canvas');
|
||||
div = document.getElementById(id);
|
||||
canvas.id = "CursorLayer";
|
||||
canvas.width = 1224;
|
||||
canvas.height = 768;
|
||||
canvas.style.zIndex = 8;
|
||||
canvas.style.position = "absolute";
|
||||
canvas.style.border = "1px solid";
|
||||
div.appendChild(canvas)
|
||||
}
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvasOld = document.getElementById("holamundo");
|
||||
// canvasOld.holamundo.removeChild(canvasOld);
|
||||
document.getElementById("div_canvas").innerHTML=""
|
||||
var canvas = document.createElement("canvas");
|
||||
div = document.getElementById('div_canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.id = "holamundo";
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
div.appendChild(canvas);
|
||||
};
|
||||
|
||||
$('.watermark').each(convertImageToCanvas);
|
||||
|
||||
});
|
||||
|
||||
var testCanvas = document.getElementById("holamundo");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
debugConsole.value=canvasData;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function archivo(evt) {
|
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Obtenemos la imagen del campo "file".
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
//Solo admitimos imágenes.
|
||||
if (!f.type.match('image.*')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = (function(theFile) {
|
||||
return function(e) {
|
||||
// Insertamos la imagen
|
||||
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
document.getElementById("list").innerHTML = ['<img style="width:<?php echo $ancho; ?>px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
};
|
||||
})(f);
|
||||
|
||||
reader.readAsDataURL(f);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('files').addEventListener('change', archivo, false);
|
||||
|
||||
/* marca */
|
||||
|
||||
|
||||
(function(w){
|
||||
var wm = (function(w){
|
||||
var doc = w.document,
|
||||
gcanvas = {},
|
||||
gctx = {},
|
||||
imgQueue = [],
|
||||
className = "watermark",
|
||||
watermark = false,
|
||||
watermarkPosition = "bottom-right",
|
||||
watermarkPath = "milfs/addon/machitroll/images/incurable/100.png?"+(+(new Date())),
|
||||
opacity = (255/(100/50)), // 50%
|
||||
initCanvas = function(){
|
||||
gcanvas = doc.createElement("canvas");
|
||||
gcanvas.style.cssText = "display:none;";
|
||||
gctx = gcanvas.getContext("2d");
|
||||
doc.body.appendChild(gcanvas);
|
||||
},
|
||||
initWatermark = function(){
|
||||
watermark = new Image();
|
||||
watermark.src = "";
|
||||
watermark.src = watermarkPath;
|
||||
|
||||
if(opacity != 255){
|
||||
if(!watermark.complete)
|
||||
watermark.onload = function(){
|
||||
applyTransparency();
|
||||
}
|
||||
else
|
||||
applyTransparency();
|
||||
|
||||
|
||||
}else{
|
||||
applyWatermarks();
|
||||
}
|
||||
|
||||
},
|
||||
// function for applying transparency to the watermark
|
||||
applyTransparency = function(){
|
||||
var w = watermark.width || watermark.offsetWidth,
|
||||
h = watermark.height || watermark.offsetHeight;
|
||||
setCanvasSize(w, h);
|
||||
gctx.drawImage(watermark, 0, 0);
|
||||
|
||||
var image = gctx.getImageData(0, 0, w, h);
|
||||
var imageData = image.data,
|
||||
length = imageData.length;
|
||||
for(var i=3; i < length; i+=4){
|
||||
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
|
||||
}
|
||||
image.data = imageData;
|
||||
gctx.putImageData(image, 0, 0);
|
||||
watermark.onload = null;
|
||||
watermark.src = "";
|
||||
watermark.src = gcanvas.toDataURL();
|
||||
// assign img attributes to the transparent watermark
|
||||
// because browsers recalculation doesn't work as fast as needed
|
||||
watermark.width = w;
|
||||
watermark.height = h;
|
||||
|
||||
applyWatermarks();
|
||||
},
|
||||
configure = function(config){
|
||||
if(config["watermark"])
|
||||
watermark = config["watermark"];
|
||||
if(config["path"])
|
||||
watermarkPath = config["path"];
|
||||
if(config["position"])
|
||||
watermarkPosition = config["position"];
|
||||
if(config["opacity"])
|
||||
opacity = (255/(100/config["opacity"]));
|
||||
if(config["className"])
|
||||
className = config["className"];
|
||||
|
||||
initCanvas();
|
||||
initWatermark();
|
||||
}
|
||||
setCanvasSize = function(w, h){
|
||||
gcanvas.width = w;
|
||||
gcanvas.height = h;
|
||||
},
|
||||
applyWatermark = function(img){
|
||||
/*
|
||||
var f = image.height / image.width;
|
||||
var newHeight = canvas.width * f;
|
||||
|
||||
*/
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = <?php echo $ancho; ?>;
|
||||
//var alto_orginal = img.height;
|
||||
//var alto = (alto_original * proporcion);
|
||||
//alert("hola pro"+alto);
|
||||
gcanvas.width = ancho;// || img.offsetWidth;
|
||||
//gcanvas.width = img.width || img.offsetWidth;
|
||||
//gcanvas.height = img.height || img.offsetHeight;
|
||||
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
|
||||
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
|
||||
var position = watermarkPosition,
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(position.indexOf("top")!=-1)
|
||||
y = 20;
|
||||
else if(position.indexOf("middle")!=-1)
|
||||
y = (gcanvas.height -watermark.height)/2;
|
||||
else
|
||||
y = gcanvas.height-watermark.height-20;
|
||||
|
||||
if(position.indexOf("left")!=-1)
|
||||
x = 20;
|
||||
else if(position.indexOf("center")!=-1)
|
||||
x = (gcanvas.width - watermark.width) /2;
|
||||
else
|
||||
x = gcanvas.width-watermark.width-20;
|
||||
|
||||
|
||||
gctx.drawImage(watermark, x, y);
|
||||
img.onload = null;
|
||||
|
||||
img.src = gcanvas.toDataURL();
|
||||
|
||||
},
|
||||
applyWatermarks = function(){
|
||||
setTimeout(function(){
|
||||
var els = doc.getElementsByClassName(className),
|
||||
len = els.length;
|
||||
while(len--){
|
||||
var img = els[len];
|
||||
if(img.tagName.toUpperCase() != "IMG")
|
||||
continue;
|
||||
|
||||
if(!img.complete){
|
||||
img.onload = function(){
|
||||
applyWatermark(this);
|
||||
};
|
||||
}else{
|
||||
applyWatermark(img);
|
||||
}
|
||||
}
|
||||
},10);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
init: function(config){
|
||||
configure(config);
|
||||
}
|
||||
};
|
||||
})(w);
|
||||
w.wmark = wm;
|
||||
})(window);
|
||||
/* marca */
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function marcar(position){
|
||||
|
||||
|
||||
var position = position;
|
||||
|
||||
var original = document.getElementById('image_output2').src ;
|
||||
var marca = document.getElementById('marca').src ;
|
||||
document.getElementById('image_output').src = original ;
|
||||
wmark.init({
|
||||
|
||||
/* config goes here */
|
||||
|
||||
"position": position, // default "bottom-right"
|
||||
|
||||
"opacity": 100, // default 50
|
||||
|
||||
"className": "watermark", // default "watermark"
|
||||
|
||||
"path": marca
|
||||
// "path": "../milfs/addon/machitroll/images/054843d530f3c83fcdbd55e688d874ec.png"
|
||||
|
||||
});
|
||||
var identificador = Math.random();
|
||||
document.getElementById('identificador').value= identificador;
|
||||
|
||||
//window.setTimeout("saveViaAJAX()", 3000); ///
|
||||
//saveViaAJAX(); ///
|
||||
//xajax_wait('aviso','Subiendo imágen');
|
||||
//window.setTimeout("xajax_machitroll_grabar_imagen(document.getElementById('debugConsole').value,"+identificador+")", 5000);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
function marcador_grabar($formulario) {
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$resultado = "Hola mundo ".$formulario[498][0]."--- $formulario[debugConsole] ---";
|
||||
$imgData = str_replace(' ','+',$formulario['debugConsole']);
|
||||
$imgData = substr($imgData,strpos($imgData,",")+1);
|
||||
$imgData = base64_decode($imgData);
|
||||
// Path where the image is going to be saved
|
||||
$nombre= MD5(rand().time());
|
||||
$filePath = "milfs/tmp/".$nombre.".png";
|
||||
// Write $imgData into the image file
|
||||
$file = fopen($filePath, 'w');
|
||||
fwrite($file, $imgData);
|
||||
fclose($file);
|
||||
|
||||
|
||||
$respuesta->addAssign("aviso","innerHTML","$resultado");
|
||||
//$respuesta->addAlert("$resultado");
|
||||
//$respuesta->addScript("javascript:location.reload(true);");
|
||||
return $respuesta;
|
||||
}
|
||||
$xajax->registerFunction("marcador_grabar");
|
||||
|
||||
?>
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 5.8 KiB |
@ -1,412 +0,0 @@
|
||||
<?php
|
||||
//include("funciones/funciones.php");
|
||||
$tags = array();
|
||||
$tags[] = "milfs/addon/marcador/images/fb198e8742561eb1a9d8da9d95fddeae.png";
|
||||
$tags[] = "milfs/addon/marcador/images/fca0a98bc665e9f026d5ea4331046893.png";
|
||||
$tags[] = "milfs/addon/marcador/images/054843d530f3c83fcdbd55e688d874ec.png";
|
||||
|
||||
$id_formulario = "58";
|
||||
|
||||
foreach ($tags as &$valor) {
|
||||
$imagen .= "<a href='#' class='list-group-item ' onclick=\" document.getElementById('marca').src='$valor' \" >
|
||||
<img class='img img-responsive center-block' src='$valor'>
|
||||
</a>";
|
||||
}
|
||||
|
||||
$imagen = "<div class='container-fluid'><ul class='list-group list-inline'>$imagen<div><div class='clearfix'></ul></div>";
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script src="https://9b8d22ae00fff2954b7cdd00a6feb4176bc56576.googledrive.com/host/0B7R2T-U-1ZrheTlfaHNQMm0zTWM/plump_modernizr.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.fileUpload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
}
|
||||
.fileUpload input.upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 10;
|
||||
padding: 0;
|
||||
font-size: 50px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
.fa{
|
||||
font-size:50px;
|
||||
}
|
||||
|
||||
#downlink_hidden , #canvas_ed, #original{
|
||||
display:none;
|
||||
}
|
||||
#body{
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div id ="body" class="container-fluid">
|
||||
<div id="div_marcador" class="container">
|
||||
<?php echo $imagen; ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='fileUpload btn btn-primary btn-block'>
|
||||
<span> <i class="fa fa-picture-o"></i>
|
||||
<input class='upload' type="file" id="files" name="files[]" /></span>
|
||||
<div id="original" ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='container-fluid'>
|
||||
<table style="" class="table text-center table-responsive">
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-center')"><i class="fa fa-caret-square-o-up"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('top-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-center')"><i class="fa fa-circle-o"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('middle-rigth')"><i class="fa fa-caret-square-o-right"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-left')"><i class="fa fa-caret-square-o-left"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-center')"><i class="fa fa-caret-square-o-down"></i></a></td>
|
||||
<td><a href="#abajo" onclick=" javascript: marcar('bottom-rigth')"><i class="fa fa-caret-square-o-right"></i></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- editor -->
|
||||
|
||||
<div class='container-fluid'>
|
||||
|
||||
<a name="abajo"></a>
|
||||
<div style="background-color:; " >
|
||||
<img class="center-block" style='display: none' id="marca" name="marca">
|
||||
|
||||
<div id="list" style=" "></div>
|
||||
<img id='image_output2' name='image_output2' src="" class="" />
|
||||
|
||||
<div id='div_canvas' style='display: none'> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form id='formulario_marcador' >
|
||||
<input type='hidden' id="debugConsole" name="debugConsole" >
|
||||
<?php $formulario = formulario_areas("$id_formulario",'campos','','');
|
||||
echo $formulario; ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class='fileUpload btn btn-success btn-block' onclick="saveViaAJAX(); xajax_marcador_grabar(xajax.getFormValues('formulario_marcador'))"><span><i class="fa fa-save"></i></span> </div>
|
||||
<div id='aviso'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
$("body").append(canvas);
|
||||
};
|
||||
|
||||
function convertImageToCanvas(image) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.getContext("2d").drawImage(image, 0, 0);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function convertCanvasToImage(canvas) {
|
||||
var image = new Image();
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
return image;
|
||||
}
|
||||
|
||||
function saveViaAJAX()
|
||||
{
|
||||
/* function loadCanvas(id) {
|
||||
var canvas = document.createElement('canvas');
|
||||
div = document.getElementById(id);
|
||||
canvas.id = "CursorLayer";
|
||||
canvas.width = 1224;
|
||||
canvas.height = 768;
|
||||
canvas.style.zIndex = 8;
|
||||
canvas.style.position = "absolute";
|
||||
canvas.style.border = "1px solid";
|
||||
div.appendChild(canvas)
|
||||
}
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
function convertImageToCanvas(i, image) {
|
||||
var canvasOld = document.getElementById("holamundo");
|
||||
// canvasOld.holamundo.removeChild(canvasOld);
|
||||
document.getElementById("div_canvas").innerHTML=""
|
||||
var canvas = document.createElement("canvas");
|
||||
div = document.getElementById('div_canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.id = "holamundo";
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
div.appendChild(canvas);
|
||||
};
|
||||
|
||||
$('.watermark').each(convertImageToCanvas);
|
||||
|
||||
});
|
||||
|
||||
var testCanvas = document.getElementById("holamundo");
|
||||
var canvasData = testCanvas.toDataURL("image/png");
|
||||
var postData = "canvasData="+canvasData;
|
||||
var debugConsole= document.getElementById("debugConsole");
|
||||
debugConsole.value=canvasData;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function archivo(evt) {
|
||||
var files = evt.target.files; // FileList object
|
||||
|
||||
// Obtenemos la imagen del campo "file".
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
//Solo admitimos imágenes.
|
||||
if (!f.type.match('image.*')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = (function(theFile) {
|
||||
return function(e) {
|
||||
// Insertamos la imagen
|
||||
document.getElementById("original").innerHTML = ['<img id="image_output2" name="image_output2" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
document.getElementById("list").innerHTML = ['<img style="width:max-600px;" id="image_output" name="image_output" class="img img-responsive watermark center-block" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
|
||||
};
|
||||
})(f);
|
||||
|
||||
reader.readAsDataURL(f);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('files').addEventListener('change', archivo, false);
|
||||
|
||||
/* marca */
|
||||
|
||||
|
||||
(function(w){
|
||||
var wm = (function(w){
|
||||
var doc = w.document,
|
||||
gcanvas = {},
|
||||
gctx = {},
|
||||
imgQueue = [],
|
||||
className = "watermark",
|
||||
watermark = false,
|
||||
watermarkPosition = "bottom-right",
|
||||
watermarkPath = "watermark.png?"+(+(new Date())),
|
||||
opacity = (255/(100/50)), // 50%
|
||||
initCanvas = function(){
|
||||
gcanvas = doc.createElement("canvas");
|
||||
gcanvas.style.cssText = "display:none;";
|
||||
gctx = gcanvas.getContext("2d");
|
||||
doc.body.appendChild(gcanvas);
|
||||
},
|
||||
initWatermark = function(){
|
||||
watermark = new Image();
|
||||
watermark.src = "";
|
||||
watermark.src = watermarkPath;
|
||||
|
||||
if(opacity != 255){
|
||||
if(!watermark.complete)
|
||||
watermark.onload = function(){
|
||||
applyTransparency();
|
||||
}
|
||||
else
|
||||
applyTransparency();
|
||||
|
||||
|
||||
}else{
|
||||
applyWatermarks();
|
||||
}
|
||||
|
||||
},
|
||||
// function for applying transparency to the watermark
|
||||
applyTransparency = function(){
|
||||
var w = watermark.width || watermark.offsetWidth,
|
||||
h = watermark.height || watermark.offsetHeight;
|
||||
setCanvasSize(w, h);
|
||||
gctx.drawImage(watermark, 0, 0);
|
||||
|
||||
var image = gctx.getImageData(0, 0, w, h);
|
||||
var imageData = image.data,
|
||||
length = imageData.length;
|
||||
for(var i=3; i < length; i+=4){
|
||||
imageData[i] = (imageData[i]<opacity)?imageData[i]:opacity;
|
||||
}
|
||||
image.data = imageData;
|
||||
gctx.putImageData(image, 0, 0);
|
||||
watermark.onload = null;
|
||||
watermark.src = "";
|
||||
watermark.src = gcanvas.toDataURL();
|
||||
// assign img attributes to the transparent watermark
|
||||
// because browsers recalculation doesn't work as fast as needed
|
||||
watermark.width = w;
|
||||
watermark.height = h;
|
||||
|
||||
applyWatermarks();
|
||||
},
|
||||
configure = function(config){
|
||||
if(config["watermark"])
|
||||
watermark = config["watermark"];
|
||||
if(config["path"])
|
||||
watermarkPath = config["path"];
|
||||
if(config["position"])
|
||||
watermarkPosition = config["position"];
|
||||
if(config["opacity"])
|
||||
opacity = (255/(100/config["opacity"]));
|
||||
if(config["className"])
|
||||
className = config["className"];
|
||||
|
||||
initCanvas();
|
||||
initWatermark();
|
||||
}
|
||||
setCanvasSize = function(w, h){
|
||||
gcanvas.width = w;
|
||||
gcanvas.height = h;
|
||||
},
|
||||
applyWatermark = function(img){
|
||||
/*
|
||||
var f = image.height / image.width;
|
||||
var newHeight = canvas.width * f;
|
||||
|
||||
*/
|
||||
var proporcion = ( img.height / img.width );
|
||||
var ancho = 600;
|
||||
//var alto_orginal = img.height;
|
||||
//var alto = (alto_original * proporcion);
|
||||
//alert("hola pro"+alto);
|
||||
gcanvas.width = ancho;// || img.offsetWidth;
|
||||
//gcanvas.width = img.width || img.offsetWidth;
|
||||
//gcanvas.height = img.height || img.offsetHeight;
|
||||
gcanvas.height = (gcanvas.width * proporcion);// || img.offsetHeight;
|
||||
gctx.drawImage(img, 0, 0,ancho,gcanvas.height);
|
||||
var position = watermarkPosition,
|
||||
x = 0,
|
||||
y = 0;
|
||||
if(position.indexOf("top")!=-1)
|
||||
y = 20;
|
||||
else if(position.indexOf("middle")!=-1)
|
||||
y = (gcanvas.height -watermark.height)/2;
|
||||
else
|
||||
y = gcanvas.height-watermark.height-20;
|
||||
|
||||
if(position.indexOf("left")!=-1)
|
||||
x = 20;
|
||||
else if(position.indexOf("center")!=-1)
|
||||
x = (gcanvas.width - watermark.width) /2;
|
||||
else
|
||||
x = gcanvas.width-watermark.width-20;
|
||||
|
||||
|
||||
gctx.drawImage(watermark, x, y);
|
||||
img.onload = null;
|
||||
|
||||
img.src = gcanvas.toDataURL();
|
||||
|
||||
},
|
||||
applyWatermarks = function(){
|
||||
setTimeout(function(){
|
||||
var els = doc.getElementsByClassName(className),
|
||||
len = els.length;
|
||||
while(len--){
|
||||
var img = els[len];
|
||||
if(img.tagName.toUpperCase() != "IMG")
|
||||
continue;
|
||||
|
||||
if(!img.complete){
|
||||
img.onload = function(){
|
||||
applyWatermark(this);
|
||||
};
|
||||
}else{
|
||||
applyWatermark(img);
|
||||
}
|
||||
}
|
||||
},10);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
init: function(config){
|
||||
configure(config);
|
||||
}
|
||||
};
|
||||
})(w);
|
||||
w.wmark = wm;
|
||||
})(window);
|
||||
/* marca */
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function marcar(position){
|
||||
|
||||
|
||||
var position = position;
|
||||
|
||||
var original = document.getElementById('image_output2').src ;
|
||||
var marca = document.getElementById('marca').src ;
|
||||
document.getElementById('image_output').src = original ;
|
||||
wmark.init({
|
||||
|
||||
/* config goes here */
|
||||
|
||||
"position": position, // default "bottom-right"
|
||||
|
||||
"opacity": 100, // default 50
|
||||
|
||||
"className": "watermark", // default "watermark"
|
||||
|
||||
"path": marca
|
||||
// "path": "../milfs/addon/marcador/images/054843d530f3c83fcdbd55e688d874ec.png"
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
function tuitealo($form,$tipo) {
|
||||
if($tipo =='formulario') {
|
||||
$formulario = formulario_areas('297','campos');
|
||||
$descripcion = remplacetas('form_id','id','297','descripcion',"") ;
|
||||
$nombre = remplacetas('form_id','id','297','nombre',"") ;
|
||||
$formulario ="
|
||||
|
||||
<h1 >$nombre[0]</h1>
|
||||
<h2>$descripcion[0]</h2>
|
||||
<form id='form_tuitealo' >
|
||||
$formulario
|
||||
<br>
|
||||
|
||||
<div id='tuitealo_div'>
|
||||
<div id='tuitealo_error'></div>
|
||||
|
||||
|
||||
|
||||
<a class='btn btn-block btn-primary' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar');\">Previsualizar</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
<div class='text-center'>
|
||||
<p class='text-center'>Powered by: <a href='https://qwerty.co/milfs'>MILFS</a></p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
";
|
||||
return $formulario;
|
||||
}
|
||||
$respuesta = new xajaxResponse('utf-8');
|
||||
$sujeto = $form[1301][0];
|
||||
$accion = $form[1302][0];
|
||||
$verbo = $form[1303][0];
|
||||
$tiempo = $form[1305][0];
|
||||
$ht = $form[1306][0];
|
||||
$mensaje = $form[1307][0];
|
||||
$arroba = $form[1301][0];
|
||||
if( $accion =="" or $verbo =="" or $tiempo =="" or $ht =="" or $arroba =="" ) {
|
||||
$error ="<div class='alert alert-warning text-center'><h1><i class='fa fa-exclamation-triangle'></i> Hay campos vacíos</h1></div>";
|
||||
$respuesta->addAssign("tuitealo_error","innerHTML","$error");
|
||||
return $respuesta;
|
||||
|
||||
}
|
||||
$arroba = remplacetas('form_datos','control',"$arroba",'contenido',"id_campo = '77'") ;
|
||||
$arroba = $arroba[0];
|
||||
$url_propia = urlencode("https://patos.redpatodos.co");
|
||||
$texto="$sujeto $accion $verbo $tiempo $ht $mensaje cc $arroba ";
|
||||
$texto = ucfirst($texto);
|
||||
$texto_url=urlencode($texto);
|
||||
$largo = strlen($texto.$url_propia);
|
||||
if($largo > 140) { $alert ="danger"; $mensaje ="<i class='fa fa-exclamation-triangle'></i> El texto es demasiado largo y se recortará";
|
||||
$texto = substr($texto, 0, 140)."..."; }
|
||||
else{$alert='success'; $mensaje="";}
|
||||
|
||||
|
||||
|
||||
$url ="https://twitter.com/share?url=$url_propia&text=$texto_url";
|
||||
|
||||
$previsualizar ="<br>
|
||||
|
||||
<div id='tuitealo_error'></div>
|
||||
<div class='alert alert-$alert'><div class='badge'>$largo</div>$mensaje<h1>$texto</h1></div>
|
||||
|
||||
<a class='btn btn-block btn-primary' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar');\">Previsualizar</a>
|
||||
<a class='btn btn-block btn-success' onclick=\"xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'confirmar');\">Tuitéalo</a>
|
||||
<img style='width:1px;' src='milfs/images/100x100.png'
|
||||
onload=\"
|
||||
document.getElementById('1301[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1302[0]').onkeyup = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1303[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1304[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1305[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1306[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
document.getElementById('1307[0]').onchange = function(){xajax_tuitealo(xajax.getFormValues('form_tuitealo'),'previsualizar')};
|
||||
|
||||
\" >
|
||||
";
|
||||
|
||||
if( $tipo =="previsualizar") {
|
||||
$control = md5(rand(1,99999999).microtime());
|
||||
$formulario_grabar ="
|
||||
|
||||
<input type='hidden' id= '1308[0]' name= '1308[0]' value='$texto' >
|
||||
<input type='hidden' id= 'form_id' name= 'form_id' value='297' >
|
||||
<input type='hidden' id= 'control' name= 'control' value='$control' >
|
||||
|
||||
";
|
||||
|
||||
$previsualizar .="$formulario_grabar";
|
||||
$respuesta->addAssign("tuitealo_div","innerHTML","$previsualizar");
|
||||
|
||||
}else{
|
||||
// <div onclick=\" xajax_formulario_grabar(xajax.getFormValues('$control'));\" class='btn btn-block btn-success'>Grabar</div>
|
||||
//$respuesta->addAssign("xajax_formulario_grabar(xajax.getFormValues('form_tuitealo'));");
|
||||
$respuesta->addScript("window.location.href ='$url';");
|
||||
|
||||
}
|
||||
|
||||
return $respuesta;
|
||||
}
|
||||
|
||||
$xajax->registerFunction("tuitealo");
|
||||
|
||||
?>
|