Ordovicium
Založený: 24.06.2005
Príspevky: 1
Zaslal: 2005-06-24 18:31
Návrat hore
Odpovedať s citátom
|
Ok, I have my directory stored in my database. Looks like "/images/quotes/mensjournal.gif"
To display it in the table as a image do following:
Add at the top, right after <?php this block:
Kód: |
// get list of images
$imageArray = array("" => "");
$imagepath = "../images/";
$dh = opendir($_SERVER["DOCUMENT_ROOT"] . $imagepath);
while(($image = readdir($dh)) !== false) {
if (!preg_match("/^\.\.?/", $image)) {
$imageArray[$imagepath . $image] = $image;
}
}
ksort($imageArray);
reset($imageArray);
|
Then go to the table where you wanna let it appear. search in this block for
and replace it with
Kód: |
'sort' => true,
"sql|LF" => "CONCAT('<img src=\"..', image, '\" border=0 height=100 width=100><br />', image)",
"values2" => $imageArray,
"escape" => false |
Works fine for me.
|
Shaba1
Založený: 27.09.2005
Príspevky: 11
Zaslal: 2005-09-30 20:31
Návrat hore
Odpovedať s citátom
|
Ordovicium Napísal: |
Ok, I have my directory stored in my database. Looks like "/images/quotes/mensjournal.gif"
To display it in the table as a image do following:
Add at the top, right after <?php this block:
Kód: |
// get list of images
$imageArray = array("" => "");
$imagepath = "../images/";
$dh = opendir($_SERVER["DOCUMENT_ROOT"] . $imagepath);
while(($image = readdir($dh)) !== false) {
if (!preg_match("/^\.\.?/", $image)) {
$imageArray[$imagepath . $image] = $image;
}
}
ksort($imageArray);
reset($imageArray);
|
Then go to the table where you wanna let it appear. search in this block for
and replace it with
Kód: |
'sort' => true,
"sql|LF" => "CONCAT('<img src=\"..', image, '\" border=0 height=100 width=100><br />', image)",
"values2" => $imageArray,
"escape" => false |
Works fine for me. |
Ovodicdum: if you are still on this forum I had some questions about the code you posted. Specifically.
What does thist statment do -->"sql|LF". Or where is it in the phpmyedit manual?
=> "CONCAT('<img src=\"..', image, '\" border=0 height=100 width=100><br />', image)",
Here I think you are printing html code out to the page that is being displayed to the user. But why do you have 'image' after the src=' statement. What exactly does CONCAT do?
I will try to look up the follow two statements in teh manual
"values2" => $imageArray,
"escape" => false
Thanks
|
coach
Založený: 21.10.2005
Príspevky: 6
Zaslal: 2005-10-31 19:15
Návrat hore
Odpovedať s citátom
|
Hi,
I made a small enhancement to avoid "empty" images
Kód: |
'sql|LF' => "IF(image = '', NULL, CONCAT('<img src=\"', image, '\" border=0 height=100 width=100><br />', image))",
|
Coach
|
Shaba1
Založený: 27.09.2005
Príspevky: 11
Zaslal: 2005-11-02 21:03
Návrat hore
Odpovedať s citátom
|
Thanks coach. But my real question was about
#1.The use of "image" without the $ in the CONCAT() statement. I know that one could use $image to get php to put the name and path of the image into the CONCAT() statement but it look like the original poster just uses the string "image" That would not seem right to me. Maybe I am missing something?
and:
#2 The use of the "sql |LF" statment. I have read in the manual about the 'sql" and the "sqlw" arrays but nowhere that I can fine does it say that it can be combined with a vertical bar and any of the "adpvlf" field options. Maybe something else I am missing.
coach Napísal: |
Hi,
I made a small enhancement to avoid "empty" images
Kód: |
'sql|LF' => "IF(image = '', NULL, CONCAT('<img src=\"', image, '\" border=0 height=100 width=100><br />', image))",
|
Coach |
|
coach
Založený: 21.10.2005
Príspevky: 6
Zaslal: 2005-11-07 17:45
Návrat hore
Odpovedať s citátom
|
Hi Shaba,
Shaba1 Napísal: |
#1.The use of "image" without the $ in the CONCAT() statement. I know that one could use $image to get php to put the name and path of the image into the CONCAT() statement but it look like the original poster just uses the string "image" That would not seem right to me. Maybe I am missing something? |
image is the name of the column in the database.
Shaba1 Napísal: |
#2 The use of the "sql |LF" statment. |
I don't know but it's working.
Coach
|
aeiche
Založený: 06.04.2007
Príspevky: 10
Zaslal: 2007-05-08 19:17
Návrat hore
Odpovedať s citátom
|
Shaba1 Napísal: |
Thanks coach. But my real question was about
#2 The use of the "sql |LF" statment. I have read in the manual about the 'sql" and the "sqlw" arrays but nowhere that I can fine does it say that it can be combined with a vertical bar and any of the "adpvlf" field options. Maybe something else I am missing.
|
The pipe or vertical bar applies the SQL or SQL only to those specific options. It's the last item in the field options section of the documentation:
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.options-variability.html
|
gb5256
Založený: 30.08.2008
Príspevky: 7
Zaslal: 2008-09-03 21:30
Návrat hore
Odpovedať s citátom
|
Hello,
great work to everybody involved !!!
I have used the code above and added the URL functions as I would like to make the picture clickable.
Here is my code:
Kód: |
$opts['fdd']['images'] = array(
'name' => 'Fotos',
'select' => 'T',
'maxlen' => 10,
'sort' => true,
"sql|LF" => "IF(images = '', NULL, CONCAT('<img src=\"images_proben/', images, '\" border=0 height=20 width=20><br />', images))",
"values2" => $imageArray,
"escape" => false,
'URLprefix' => 'http://webxxxxxx/images_proben/',
'URL' => $value
); |
The problem is, that the link is like this:
Kód: |
http://webxxxxxxxxxx/images_proben/%3Cimg%20src=%22images_proben/1.jpg%22%20border=0%20height=20%20width=20%3E%3Cbr%20/%3E1.jpg |
So it used as a value the HTML used for displaying the image. Can I overwrite that somehow?
|
ajh
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2008-09-04 12:54
Návrat hore
Odpovedať s citátom
|
Don't use the URL functions with SQL - they clash. Use the CONCAT function in the SQL line to build the complete correct URL as you want to see it.
|
gb5256
Založený: 30.08.2008
Príspevky: 7
Zaslal: 2008-09-04 19:20
Návrat hore
Odpovedať s citátom
|
Can I use the SQL command twice within the same block?
|
ajh
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2008-09-08 09:40
Návrat hore
Odpovedať s citátom
|
No...but you shouldn't need to. You should be able to construct an SQL statement that does anything you want for one transaction. If you need to do multiple transactions (ie post something to another table), then you need to look at triggers.
|
ACastillo01
Založený: 31.03.2022
Príspevky: 1
Zaslal: 2022-03-31 13:42
Návrat hore
Odpovedať s citátom
|
Choosing the right resume writing services is crucial because your resume is your ticket to a job interview. And while you may think you could write your own resume, it's not that easy. I suggest you
top resume writing services
to leanr descent new techniques about the reume services. Writing resumes is a complicated job that requires attention to detail and in-depth knowledge of how companies evaluate resumes. All this and more will be provided by our expert tailor-made resume service team.
|
Odoslať novú tému
Odpovedať na tému
|