?
Solved

Output Images

Posted on 2003-03-29
3
Medium Priority
?
341 Views
Last Modified: 2010-08-05
Greets,
I have an idea, but I need some help.

<?php
$GURL = "http://www.site.com/ShowPhoto.php?Type=1&ID=08";
$GURL2  = eregi_replace("08", "09", $GURL);
$GURL3  = eregi_replace("08", "10", $GURL);
$GURL4  = eregi_replace("08", "11", $GURL);
$GURL5  = eregi_replace("08", "12", $GURL);
$GURL6  = eregi_replace("08", "13", $GURL);
$GURL7  = eregi_replace("08", "14", $GURL);
$GURL8  = eregi_replace("08", "15", $GURL);
$GURL9  = eregi_replace("08", "16", $GURL);
$GURL10  = eregi_replace("08", "17", $GURL);
$GURL11  = eregi_replace("08", "18", $GURL);
$GURL12  = eregi_replace("08", "19", $GURL);
$GURL13  = eregi_replace("08", "20", $GURL);

               
echo "<img src='$GURL'><HR>";
echo "<img src='$GURL2'><HR>";
echo "<img src='$GURL3'><HR>";
echo "<img src='$GURL4'><HR>";
echo "<img src='$GURL5'><HR>";
echo "<img src='$GURL6'><HR>";
echo "<img src='$GURL7'><HR>";
echo "<img src='$GURL8'><HR>";
echo "<img src='$GURL9'><HR>";
echo "<img src='$GURL10'><HR>";
echo "<img src='$GURL11'><HR>";
echo "<img src='$GURL12'><HR>";
echo "<img src='$GURL13'><HR>";
echo "<img src='$GURL13'><HR>";
?>
 

I'm trying to output about 1500 images in a page.

Begins with:
?Type=1&ID=08

Ends with:
?Type=1&ID=1504 (or around there)

So, I need to learn how to make something which creates numbers 01-1600, and inserts each consecutively into a new echoed string, untill its complete.

Any help?
0
Comment
Question by:Passionate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
bljak earned 300 total points
ID: 8230475
Okay, you want code above auto generated
LOOPS are your friends ...

(int)$startImage = 8;
(int)$endImage = 1600;
$GURL = "http://www.site.com/ShowPhoto.php?Type=1&ID=";

for($a = $startImage;$a <= $endImage;$a++)
{
  echo "<img src=\"".$GURL.$a."\"><HR>";
}

thats all, though if you want it to have 08, 09, and above 10 it doesn't have 0 infront of it, use this for loop, variables stay same

for($a = $startImage;$a <= $endImage;$a++)
{
  if($a < 10)
  {
    //changes $a to string
    $currentA = "0".$a;
  } else {
    $currentA = $a;
  }
  //echoes url + current number to code
  echo "<img src=\"".$GURL.$currentA."\"><HR>";
}

hope this helped some
//bljak

0
 
LVL 15

Expert Comment

by:VGR
ID: 8230593
BTW, 1500 images on one HTML page (even 10KB/image only) is total madness ;-)
0
 

Author Comment

by:Passionate
ID: 8236240
Thank you.

Sorry it took so long for me to reply.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question